AutoTrain 文件

AutoTrain API

您正在檢視的是需要從原始碼安裝。如果您希望使用常規的 pip 安裝,請檢視最新的穩定版本 (v0.8.24)。
Hugging Face's logo
加入 Hugging Face 社群

並獲得增強的文件體驗

開始使用

AutoTrain API

藉助 AutoTrain API,您可以執行自己的 AutoTrain 例項,並使用它在 Hugging Face Spaces 基礎設施上訓練模型(本地訓練即將推出)。此 API 專為與 AutoTrain 相容的模型和資料集設計,它提供了一個簡單的介面,只需最少的配置即可訓練模型。

快速入門

要開始使用 AutoTrain API,您只需按照“本地執行”部分中的討論安裝 autotrain-advanced,然後執行 autotrain app 命令即可。

$ autotrain app --port 8000 --host 127.0.0.1

然後,您可以在 http://127.0.0.1:8000/docs 訪問 API 參考文件。

用法示例

curl -X POST "http://127.0.0.1:8000/api/create_project" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer hf_XXXXX" \
     -d '{
           "username": "abhishek",
           "project_name": "my-autotrain-api-model",
           "task": "llm:orpo",
           "base_model": "meta-llama/Meta-Llama-3-8B-Instruct",
           "hub_dataset": "argilla/distilabel-capybara-dpo-7k-binarized",
           "train_split": "train",
           "hardware": "spaces-a10g-large",
           "column_mapping": {
               "text_column": "chosen",
               "rejected_text_column": "rejected",
               "prompt_text_column": "prompt"
           },
           "params": {
               "block_size": 1024,
               "model_max_length": 4096,
               "max_prompt_length": 512,
               "epochs": 1,
               "batch_size": 2,
               "lr": 0.00003,
               "peft": true,
               "quantization": "int4",
               "target_modules": "all-linear",
               "padding": "right",
               "optimizer": "adamw_torch",
               "scheduler": "linear",
               "gradient_accumulation": 4,
               "mixed_precision": "fp16",
               "chat_template": "chatml"
           }
         }'
< > 在 GitHub 上更新

© . This site is unofficial and not affiliated with Hugging Face, Inc.