AutoTrain 文件
本地訓練快速入門指南
您正在檢視的是需要從原始碼安裝。如果您想使用常規的 pip 安裝,請檢視最新的穩定版本(v0.8.24)。
加入 Hugging Face 社群
並獲得增強的文件體驗
開始使用
本地訓練快速入門指南
本快速入門指南適用於本地安裝和使用。如果您想在 Hugging Face Spaces 上使用 AutoTrain,請參閱 AutoTrain on Hugging Face Spaces 部分。
您可以使用 pip 安裝 AutoTrain Advanced
$ pip install autotrain-advanced
建議在虛擬環境中安裝 autotrain-advanced,以避免與其他包發生衝突。注意:AutoTrain 不會安裝 pytorch、torchaudio、torchvision 或任何其他大型依賴。您需要單獨安裝它們。
$ conda create -n autotrain python=3.10
$ conda activate autotrain
$ pip install autotrain-advanced
$ conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
$ conda install -c "nvidia/label/cuda-12.1.0" cuda-nvcc
$ conda install xformers -c xformers
$ python -m nltk.downloader punkt
$ pip install flash-attn --no-build-isolation # if you want to use flash-attn
$ pip install deepspeed # if you want to use deepspeed
執行 AutoTrain 使用者介面 (UI)
要在本地執行 autotrain 應用,您可以使用以下命令
$ export HF_TOKEN=your_hugging_face_write_token
$ autotrain app --host 127.0.0.1 --port 8000
這將在 http://127.0.0.1:8000
上啟動應用。
使用 AutoTrain 命令列介面 (CLI)
也可以使用命令列介面 (CLI)
$ export HF_TOKEN=your_hugging_face_write_token
$ autotrain --help
這將顯示可以使用的 CLI 命令
usage: autotrain <command> [<args>]
positional arguments:
{
app,
llm,
setup,
api,
text-classification,
text-regression,
image-classification,
tabular,
spacerunner,
seq2seq,
token-classification
}
commands
options:
-h, --help show this help message and exit
--version, -v Display AutoTrain version
--config CONFIG Optional configuration file
For more information about a command, run: `autotrain <command> --help`
建議在使用 CLI 進行訓練時,只使用 autotrain --config CONFIG_FILE
命令。
終端使用者會感興趣的 autotrain 命令是
app
: 啟動 AutoTrain UIllm
: 訓練一個語言模型text-classification
: 訓練一個文字分類模型text-regression
: 訓練一個文本回歸模型image-classification
: 訓練一個影像分類模型tabular
: 訓練一個表格資料模型spacerunner
: 使用 SpaceRunner 訓練任何自定義模型seq2seq
: 訓練一個序列到序列模型token-classification
: 訓練一個詞元分類模型
注意:如果您使用首選的 autotrain --config CONFIG_FILE
命令來訓練模型,則不需要上述命令。