fix export
This commit is contained in:
parent
8172530d54
commit
3b4a59bfb1
|
@ -294,11 +294,12 @@ def patch_config(
|
|||
init_kwargs["torch_dtype"] = model_args.compute_dtype
|
||||
if not is_deepspeed_zero3_enabled():
|
||||
init_kwargs["low_cpu_mem_usage"] = model_args.low_cpu_mem_usage
|
||||
if "device_map" not in init_kwargs: # quant models cannot use auto device map
|
||||
init_kwargs["device_map"] = model_args.device_map or {"": get_current_device()}
|
||||
if model_args.low_cpu_mem_usage:
|
||||
if "device_map" not in init_kwargs: # quant models cannot use auto device map
|
||||
init_kwargs["device_map"] = model_args.device_map or {"": get_current_device()}
|
||||
|
||||
if init_kwargs["device_map"] == "auto":
|
||||
init_kwargs["offload_folder"] = model_args.offload_folder
|
||||
if init_kwargs["device_map"] == "auto":
|
||||
init_kwargs["offload_folder"] = model_args.offload_folder
|
||||
|
||||
|
||||
def patch_model(
|
||||
|
|
|
@ -42,8 +42,7 @@ def run_exp(args: Optional[Dict[str, Any]] = None, callbacks: Optional[List["Tra
|
|||
|
||||
def export_model(args: Optional[Dict[str, Any]] = None):
|
||||
model_args, data_args, finetuning_args, _ = get_infer_args(args)
|
||||
|
||||
model_args.device_map = {"": "cpu"}
|
||||
model_args.low_cpu_mem_usage = False
|
||||
|
||||
if model_args.export_dir is None:
|
||||
raise ValueError("Please specify `export_dir` to save model.")
|
||||
|
|
Loading…
Reference in New Issue