SuperAPI AI 工具集

funsloth-hfjobs

部署与运维

查看项目

更新于 10-15 17:34

技能介绍

用途:在 Hugging Face Jobs(云端 GPU 训练)上运行 Unsloth 训练,充当训练管理工具,并可选接入 WandB 监控。

前提条件:需完成 HF 认证,可用 huggingface-cli whoami 检查(未登录则先登录);使用 HF Jobs 需要 PRO 订阅或组织计算权限;训练需要来自 funsloth-train 的 notebook 或脚本。

主要能力与流程:

  1. 选择硬件:A10G 24GB 约 ~$1.50/hr,适合 7-14B LoRA;A100 40GB 约 ~$4/hr,适合 14-34B;A100 80GB 约 ~$6/hr,适合 70B;H100 80GB 约 ~$8/hr,最快。模型与 GPU 的对应见 references/HARDWARE_GUIDE.md。
  2. 将 notebook 转为脚本:HF Jobs 需要 PEP 723 脚本格式,可用 scripts/train_sft.py 作为模板。
  3. 可选 WandB 集成:在脚本中加入 import wandb 与 wandb.init(project="funsloth-training"),并在 TrainingArguments 中加入 report_to="wandb",同时设置 export WANDB_API_KEY="your-key"。
  4. 估算成本:python scripts/estimate_cost.py --tokens {total_tokens} --platform hfjobs
  5. 启动任务:创建 job_config.yaml(含 compute.gpu、gpu_count、script、outputs),然后运行 huggingface-cli jobs create --config job_config.yaml
  6. 监控进度:huggingface-cli jobs status {job_id} 与 huggingface-cli jobs logs {job_id} --follow;WandB 面板地址为 https://wandb.ai/{username}/funsloth-training
  7. 下载产物:使用 huggingface_hub 的 snapshot_download(repo_id="{username}/funsloth-job", local_dir="./outputs")
  8. 交接:可继续使用 funsloth-upload 上传到 Hub 并生成模型卡。

错误处理:无 HF Jobs 权限需获取 PRO 订阅;OOM 需减小 batch size 或升级 GPU;任务超时需启用 checkpointing;脚本报错需检查 PEP 723 依赖。

附带资源:scripts/train_sft.py(PEP 723 脚本模板)、scripts/estimate_cost.py(成本估算)、references/PLATFORM_COMPARISON.md、references/HARDWARE_GUIDE.md、references/TROUBLESHOOTING.md。

限制:资料未提供除上述硬件价格外的其他收费、平台支持范围或效果保证,相关内容暂未提供。