# HuggingFaceHub

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/llms/huggingface_hub/HuggingFaceHub)

HuggingFaceHub  models.
! This class is deprecated, you should use HuggingFaceEndpoint instead.

To use, you should have the ``huggingface_hub`` python package installed, and the
environment variable ``HUGGINGFACEHUB_API_TOKEN`` set with your API token, or pass
it as a named parameter to the constructor.

Supports `text-generation`, `text2text-generation`, `conversational`, `translation`,
 and `summarization`.

## Signature

```python
HuggingFaceHub()
```

## Description

**Example:**

.. code-block:: python

from langchain_community.llms import HuggingFaceHub
hf = HuggingFaceHub(repo_id="gpt2", huggingfacehub_api_token="my-api-key")

## Extends

- `LLM`

## Properties

- `client`
- `repo_id`
- `task`
- `model_kwargs`
- `huggingfacehub_api_token`
- `model_config`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-community/llms/huggingface_hub/HuggingFaceHub/validate_environment)

## ⚠️ Deprecated

Deprecated since version 0.0.21. Will be removed in version 1.0.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/llms/huggingface_hub.py#L23)