fix(模型): 修正本地 guard 模型设备加载

将示例配置的 guard 模型设备改为 CPU,匹配当前 CPU 版 PyTorch 环境。使用 Transformers 的 dtype 参数替代已弃用的 torch_dtype,消除启动警告并保持模型加载流程正常。
This commit is contained in:
starrrLight committed 2026-10-16 13:49:23 +08:00
1 parent e880d5cd62
commit 7652641333
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ llm:
- id: guard_model
type: guard
file: models/guard_model
load: {device: cuda}
load: {device: cpu}
limits:
max_input_tokens: 4096
max_new_tokens: 32
+2 -2
View File
@@ -27,11 +27,11 @@ def guard_worker_main(
)
stage = "load_model"
dtype_name = load.get("dtype", "auto")
torch_dtype = "auto" if dtype_name == "auto" else getattr(torch, dtype_name)
dtype = "auto" if dtype_name == "auto" else getattr(torch, dtype_name)
device = load.get("device", "cpu")
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch_dtype,
dtype=dtype,
**hub_options,
)
stage = "move_to_device"