所有语言版本中的命令和代码均保持英文。请将大写占位符替换为您账户和付费作业中的实际值;请勿将真实密钥粘贴到共享笔记本或日志中。
模型兼容性检查
- 参考模型访问 服务商方案与可用的教师模型
- 学生模型 架构和固定版本权重
- 方法 SFT 或兼容的适配器训练
- 运行环境 精度、内存和依赖
参考模型访问: 服务商方案与可用的教师模型. 学生模型: 架构和固定版本权重. 方法: SFT 或兼容的适配器训练. 运行环境: 精度、内存和依赖
在服务商方案内选择
请使用当前目录中的参考模型标识符及作业访问信息。会话可选用同一付费服务商和源产品中的 reference_model_id。此操作会保留已购买的学生模型和发票。准备过程一旦生成数据或开始尝试,就不能在该会话中更换参考模型;请勿在不说明的情况下混用教师模型数据。
- 参考模型必须持续可用,并与已购买的训练方法和学生模型兼容。
- 仅限现有客户的限制仍然有效。
- 模型显示名称不一定是其 API 标识符。
import os
from fusionpointai_training import TrainingClient
client = TrainingClient(api_key=os.environ["FUSIONPOINTAI_API_KEY"])
# Set this to a reference ID included in your paid provider plan.
reference_id = int(os.environ["FUSIONPOINTAI_REFERENCE_MODEL_ID"])
session = client.open_session(
os.environ["FUSIONPOINTAI_JOB_UUID"],
runtime="customer_datacenter",
reference_model_id=reference_id,
)
# Change the reference only BEFORE preparation or generation attempts.
print(session["reference_model_id"])
加载固定版本的本地学生模型
TrainingProject 通过已注册的 Transformers 因果语言模型适配器接受现有本地模型路径。加载模型文件时会禁用远程代码。训练前会根据所选方法检查模型架构、tokenizer、上下文长度、精度和可用设备内存。仓库标识符必须在项目根目录内解析到固定版本。
- SFT 会更新符合条件的模型参数;LoRA 和 QLoRA 训练适配器。
- 本地权重必须配有兼容的 tokenizer 和模型配置。
- 仅支持推理的 API 模型不是可训练的学生模型检查点。
# Continue with the client and session from the quickstart.
state = client.get_session(session["id"])
configuration = state["configuration"]
print(configuration["student_checkpoint"]["repository"])
print(configuration["student_checkpoint"]["revision"])
print(configuration["method"])
print(configuration["sdk_training"])
# These values come from the approved job, not local overrides.
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.
检查适配器与运行环境兼容性
已注册的 Transformers 因果语言模型适配器会检查实际模型、训练方法、精度、硬件、分布式方式和导出格式的兼容性。它并不支持所有架构或 GPU 配置。不支持的组合会在兼容性检查中失败;不能根据配置标签推断硬件或模型能力。
- 仅使用适配器可在禁用远程代码的情况下加载的模型布局。
- QLoRA 需要兼容的 CUDA 和 bitsandbytes 支持。
- 兼容性检查不是基准测试,也不保证能在其他运行环境成功推理。