> ## Documentation Index
> Fetch the complete documentation index at: https://ikun.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# HuggingFace

> 了解如何在 Agno 中使用 HuggingFace 模型。

Hugging Face 提供了一系列尖端的语言模型，可满足各种自然语言处理任务的需求，
包括文本生成、文本摘要、翻译和问答。
这些模型可通过 Hugging Face Transformers 库获得，因其易用性、灵活性和全面的文档而得到广泛采用。

在此处 [探索 HuggingFace 的语言模型](https://huggingface.co/docs/text-generation-inference/en/supported_models)。

## 认证

设置您的 `HF_TOKEN` 环境变量。您可以在 [此处从 HuggingFace 获取](https://huggingface.co/settings/tokens)。

<CodeGroup>
  ```bash Mac theme={null}
  export HF_TOKEN=***
  ```

  ```bash Windows theme={null}
  setx HF_TOKEN ***
  ```
</CodeGroup>

## 示例

将 `HuggingFace` 与您的 `Agent` 一起使用：

<CodeGroup>
  ```python agent.py theme={null}
  from agno.agent import Agent, RunResponse
  from agno.models.huggingface import HuggingFace

  agent = Agent(
      model=HuggingFace(
          id="meta-llama/Meta-Llama-3-8B-Instruct",
          max_tokens=4096,
      ),
      markdown=True
  )

  # Print the response on the terminal
  agent.print_response("Share a 2 sentence horror story.")
  ```
</CodeGroup>

<Note>在此处 [查看更多示例](../examples/models/huggingface)。</Note>

## 参数

<Snippet file="model-hf-params.mdx" />

`HuggingFace` 是 [Model](/reference/models/model) 类的子类，可以访问相同的参数。
