Convert torch.bfloat16, torch.float16, etc. to vLLM valid dtypes (#2811)
* Convert torch.bfloat16, torch.float16, etc. to vLLM valid dtypes * removed newlines and extra whitespace
This commit is contained in:
parent
35b09e2d2a
commit
3ff04c3d09
1 changed files with 11 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue