Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Convert torch.bfloat16, torch.float16, etc. to vLLM valid dtypes (#2811)

Rishabh3ff04c3d0944
diff --git a/unsloth/dataprep/synthetic.py b/unsloth/dataprep/synthetic.py
index de6aff560c3..f3fbf772227 100644
--- a/unsloth/dataprep/synthetic.py
+++ b/unsloth/dataprep/synthetic.py
@@ -78,7 +78,17 @@ class SyntheticDataKit:
use_bitsandbytes = False,
**kwargs,
)
-
+ if "dtype" in engine_args:
+ dtype_val = engine_args["dtype"]
+ # Convert torch.bfloat16, torch.float16, etc. to valid CLI string
+ if hasattr(dtype_val, "name"):
+ engine_args["dtype"] = dtype_val.name
+ elif isinstance(dtype_val, str) and dtype_val.startswith("torch."):
+ engine_args["dtype"] = dtype_val.split(".")[-1]
+ # Only allow valid vLLM choices
+ valid_dtypes = {"auto", "bfloat16", "float", "float16", "float32", "half"}
+ if engine_args["dtype"] not in valid_dtypes:
+ engine_args["dtype"] = "auto"
if "device" in engine_args: del engine_args["device"]
if "model" in engine_args: del engine_args["model"]
if "compilation_config" in engine_args: