dtype change

This commit is contained in:
Andrea Pozzetti
2025-11-10 17:53:05 +00:00
parent 8ee49b9f41
commit 3b6fc2eacb
+6
View File
@@ -39,6 +39,12 @@ def load_sa2va(model_name, config, sa2va_dtype="auto"):
}
torch_dtype = dtype_map.get(sa2va_dtype, "auto")
# Force float32 on CPU to avoid dtype mismatches
# SA2VA with "auto" uses bfloat16 on GPU but this causes issues on CPU
if torch_dtype == "auto" and not torch.cuda.is_available():
torch_dtype = torch.float32
print(f"⚙️ Forcing float32 dtype for CPU compatibility")
print(f"📥 Loading model from HuggingFace ({hf_id})...")
print(f"📂 Cache directory: {cache_dir}")
print(f"⚠️ IMPORTANT: trust_remote_code=True is required for SA2VA")