diff --git a/unsloth/dataprep/synthetic.py b/unsloth/dataprep/synthetic.py index de6aff560c..f3fbf77222 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: