所有语言版本中的命令和代码均保持英文。请将大写占位符替换为您账户和付费作业中的实际值;请勿将真实密钥粘贴到共享笔记本或日志中。
选择训练位置
- 托管服务 约定的 FusionPointAI GPU 环境
- 您的数据中心 由客户控制的 GPU 和存储
- 笔记本 兼容 Colab 的运行环境
- 本地制品 推理前先导出并验证
托管服务: 约定的 FusionPointAI GPU 环境. 您的数据中心: 由客户控制的 GPU 和存储. 笔记本: 兼容 Colab 的运行环境. 本地制品: 推理前先导出并验证
选择您控制的运行环境
TrainingProject 接受 fusionpointai_hosting、customer_datacenter 或 colab 作为运行环境标识符。该标识符不会创建 GPU 实例、提供笔记本算力,也不保证设备兼容性。安装兼容依赖、妥善保管密钥,并在执行本地模型训练的环境中检查持久存储。
- 笔记本会话可能终止,存储也可能是临时的。
- 教师 API 需要网络连接;本地训练在所选运行环境中进行。
- 计算资源和参考模型访问是两项独立服务。
fusionpointai_hosting -> agreed FusionPointAI compute environment
customer_datacenter -> your own compatible compute environment
colab -> compatible notebook runtime
Choose the runtime already approved for your paid job.
Selecting a runtime does not allocate GPUs or notebook credits.
# Run in a notebook terminal/shell after installing the SDK.
# Set FUSIONPOINTAI_API_KEY through the runtime's secret facility.
# The downloaded source includes the current Colab example.
curl --fail --silent --show-error \
https://fusionpointai.com/downloads/fusionpointai-training.zip \
--output fusionpointai-training.zip
unzip fusionpointai-training.zip -d fusionpointai-training-src
python fusionpointai-training-src/examples/colab_training.py \
--job "$FUSIONPOINTAI_JOB_UUID" --output /content/customer-model-run-001
# Output must be new. Save your artifact before the notebook is terminated.
import os
supported_runtimes = {
"fusionpointai_hosting",
"customer_datacenter",
"colab",
}
runtime = os.environ["FUSIONPOINTAI_TRAINING_RUNTIME"]
if runtime not in supported_runtimes:
raise ValueError("Choose a supported training runtime")
print("Selected runtime:", runtime)
# Selection alone does not allocate compute or open a training session.
from importlib.metadata import PackageNotFoundError, version
from importlib.util import find_spec
for package in ("fusionpointai-training", "httpx", "torch", "transformers", "peft"):
try:
print(f"{package}=={version(package)}")
except PackageNotFoundError:
print(f"{package}: not installed")
for module in ("torch", "transformers", "peft", "safetensors"):
print(f"{module} importable:", find_spec(module) is not None)
# The train extra includes optional model-training dependencies; inspect before use.
检查本地项目制品
项目运行会在其拥有的输出目录中写入模型或适配器文件、tokenizer 资源、训练和评估报告、运行元数据及制品清单。导出适配器需要完全匹配的基础模型和 tokenizer。导出不会将本地模型压缩包或部署包上传到 API。
- 根据清单核对制品路径、文件大小和 SHA-256。
- 将模型和 tokenizer 的版本固定信息一并保存。
- 交付文件中不得包含 API 密钥、数据集机密或无关文件。
cat ./support-project/runs/support-001/training-report.json
cat ./support-project/runs/support-001/evaluation-report.json
cat ./support-project/runs/support-001/artifact-manifest.json
sha256sum ./support-project/runs/support-001/exports/safetensors/artifact-manifest.json
# Compare the digest with the value returned by project.export().
# Adapter exports also require the matching base model and tokenizer.
独立使用导出的模型
使用兼容的推理运行环境加载导出的模型或适配器,并在向用户提供服务前完成任务验收。学生模型独立部署后,常规推理无需调用教师模型。导出会验证本地文件并写入可复现性清单;它不会部署模型,也不保证每种格式都能在所有设备上运行。
- 部署时再次检查 tokenizer 兼容性、精度和内存需求。
- 保留可用于回滚的制品及其评估报告。
- 替代模型通过验收前,不要覆盖仍在运行的已部署模型。