[FixBug] Improve exception string in tensorizer.py (#31680)

Signed-off-by: maang <maang_h@163.com>
Signed-off-by: maang-h <55082429+maang-h@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
maang
2026-01-11 21:01:53 +08:00
committed by GitHub
parent d70249e2e9
commit a34abc49b7

View File

@@ -764,7 +764,10 @@ def tensorize_lora_adapter(lora_path: str, tensorizer_config: TensorizerConfig):
elif tensor_path.endswith(".bin"):
tensors = torch.load(tensor_path, weights_only=True)
else:
raise ValueError("Unsupported file: %s", tensor_path)
raise ValueError(
f"Unsupported adapter model file: {tensor_path}. "
f"Must be a .safetensors or .bin file."
)
with open(config_path) as f:
config = json.load(f)