mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-15 16:18:10 +08:00
fix export
Former-commit-id: c9b968b84c97c9a00fbb43194c3adc9354d74f3b
This commit is contained in:
parent
764cfb506d
commit
aabe90343e
@ -294,6 +294,7 @@ def patch_config(
|
|||||||
init_kwargs["torch_dtype"] = model_args.compute_dtype
|
init_kwargs["torch_dtype"] = model_args.compute_dtype
|
||||||
if not is_deepspeed_zero3_enabled():
|
if not is_deepspeed_zero3_enabled():
|
||||||
init_kwargs["low_cpu_mem_usage"] = model_args.low_cpu_mem_usage
|
init_kwargs["low_cpu_mem_usage"] = model_args.low_cpu_mem_usage
|
||||||
|
if model_args.low_cpu_mem_usage:
|
||||||
if "device_map" not in init_kwargs: # quant models cannot use auto device map
|
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()}
|
init_kwargs["device_map"] = model_args.device_map or {"": get_current_device()}
|
||||||
|
|
||||||
|
@ -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):
|
def export_model(args: Optional[Dict[str, Any]] = None):
|
||||||
model_args, data_args, finetuning_args, _ = get_infer_args(args)
|
model_args, data_args, finetuning_args, _ = get_infer_args(args)
|
||||||
|
model_args.low_cpu_mem_usage = False
|
||||||
model_args.device_map = {"": "cpu"}
|
|
||||||
|
|
||||||
if model_args.export_dir is None:
|
if model_args.export_dir is None:
|
||||||
raise ValueError("Please specify `export_dir` to save model.")
|
raise ValueError("Please specify `export_dir` to save model.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user