fix: mocker engines should ignore downloading weights from hf (again) (#3664)

Signed-off-by: PeaBrane <yanrpei@gmail.com>
This commit is contained in:
Yan Ru Pei 2025-10-15 19:48:40 -07:00 committed by GitHub
parent 734d2f87a8
commit ae4e96a2bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -37,7 +37,9 @@ pub async fn run(
}
Some(p) => {
// model_path might be an HF repo, not a local path. Resolve it by downloading.
Some(LocalModel::fetch(&p.display().to_string(), false).await?)
// Mocker only needs tokenizer, not weights
let ignore_weights = matches!(out_opt, Some(Output::Mocker));
Some(LocalModel::fetch(&p.display().to_string(), ignore_weights).await?)
}
};

View File

@ -215,7 +215,9 @@ pub fn make_engine<'p>(
let local_path = if model_path.exists() {
model_path
} else {
LocalModel::fetch(&model_path.display().to_string(), false)
// Mocker only needs tokenizer, not weights
let ignore_weights = matches!(args.engine_type, EngineType::Mocker);
LocalModel::fetch(&model_path.display().to_string(), ignore_weights)
.await
.map_err(to_pyerr)?
};