Skip to content

Add a 'chat' extra #39183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ pipeline("the secret to baking a really good cake is ")
To chat with a model, the usage pattern is the same. The only difference is you need to construct a chat history (the input to `Pipeline`) between you and the system.

> [!TIP]
> You can also chat with a model directly from the command line.
> You can also chat with a model directly from the command line. Please make sure you have the `chat` extra installed:
> ```shell
> pip install .[chat] # or pip install transformers[chat]
> transformers chat Qwen/Qwen2.5-0.5B-Instruct
> ```

Expand Down
7 changes: 7 additions & 0 deletions docs/source/en/conversations.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ This guide shows you how to quickly start chatting with Transformers from the co
### Interactive chat session

After you've [installed Transformers](./installation.md), chat with a model directly from the command line as shown below. It launches an interactive session with a model, with a few base commands listed at the start of the session.
For this to work, you need to have installed the chat extra:

```bash
pip install transformers[chat]
```

You can then launch an interactive session as follows:

```bash
transformers chat Qwen/Qwen2.5-0.5B-Instruct
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ def run(self):
extras["integrations"] = extras["hub-kernels"] + extras["optuna"] + extras["ray"] + extras["sigopt"]

extras["serving"] = deps_list("pydantic", "uvicorn", "fastapi", "starlette")
extras["chat"] = deps_list("aiohttp", "rich")
extras["audio"] = deps_list(
"librosa",
"pyctcdecode",
Expand Down
Loading