Implementation:Lm sys FastChat Pip Install Fschat
| Field | Value |
|---|---|
| Page Type | Implementation (External Tool Doc) |
| Title | Pip Install Fschat |
| Repository | lm-sys/FastChat |
| Workflow | Vicuna SFT Finetuning |
| Domains | Python Packaging, ML Training Environment |
| Knowledge Sources | pyproject.toml (lm-sys/FastChat), pip documentation |
| Last Updated | 2026-02-07 14:00 GMT |
Overview
This implementation documents the pip install -e ".[train]" command used to install the fschat package (v0.2.36) in editable mode with training dependencies. This is the entry point for setting up the environment required by the Vicuna SFT fine-tuning workflow in the FastChat repository.
Description
The FastChat project is distributed as the fschat Python package, defined in pyproject.toml. The package uses setuptools as its build backend and declares multiple optional dependency groups (extras) to support different usage scenarios. For the SFT training workflow, the [train] extra must be installed alongside the base dependencies.
Base Dependencies
The base installation includes:
aiohttp,fastapi,httpx-- async HTTP and API frameworkmarkdown2[all],nh3-- text processing and sanitizationnumpy-- numerical computingprompt_toolkit>=3.0.0-- interactive promptspydantic<3,>=2.0.0,pydantic-settings-- data validationpsutil,requests,rich>=10.0.0-- system utilities and HTTPshortuuid,tiktoken,uvicorn-- identifiers, tokenization, ASGI server
[train] Extra
The [train] extra installs the following additional packages:
| Package | Version Constraint | Purpose |
|---|---|---|
einops |
(any) | Tensor operation reshaping, used in attention implementations |
flash-attn |
>=2.0 |
Flash Attention 2 for memory-efficient and fast attention computation during training |
wandb |
(any) | Weights & Biases experiment tracking and logging |
[model_worker] Extra
The [model_worker] extra is also relevant for training environments since it provides core ML libraries:
| Package | Version Constraint | Purpose |
|---|---|---|
accelerate |
>=0.21 |
Hugging Face Accelerate for distributed training orchestration |
peft |
(any) | Parameter-Efficient Fine-Tuning (LoRA, etc.) |
sentencepiece |
(any) | Tokenizer backend for SentencePiece models (e.g., LLaMA) |
torch |
(any) | PyTorch deep learning framework |
transformers |
>=4.31.0 |
Hugging Face Transformers (must be >=4.31.0 for RoPE scaling support) |
Usage
Code Reference
Source Location
pyproject.toml:L1-36 in the lm-sys/FastChat repository.
Signature
pip install -e ".[train]"
For a complete training setup that also includes model worker dependencies:
pip install -e ".[model_worker,train]"
Import
After installation, the package is importable as:
import fastchat
from fastchat.train.train import train
I/O Contract
Inputs:
- A cloned copy of the lm-sys/FastChat repository.
- Python >= 3.8 runtime environment.
- (For
flash-attn) A CUDA-capable GPU with compatible drivers and toolkit.
Outputs:
- The
fschatpackage (v0.2.36) installed in editable mode. - All base dependencies plus training extras available in the environment.
- The
fastchatPython namespace available for import.
Usage Examples
Basic training environment setup:
# Clone the repository
git clone https://github.com/lm-sys/FastChat.git
cd FastChat
# Create a virtual environment
python -m venv venv
source venv/bin/activate
# Install with training extras
pip install -e ".[train]"
# Verify installation
python -c "import fastchat; print(fastchat.__version__)"
Full training environment with model worker dependencies:
pip install -e ".[model_worker,train]"