Former-commit-id: 8d8956bad542c0e1c0f7edbf4ffc22bb0f8788ae
This commit is contained in:
hiyouga 2024-03-12 17:08:34 +08:00
parent b983de9f4f
commit 0b7e870b07
2 changed files with 7 additions and 0 deletions

View File

@ -97,6 +97,10 @@ class ModelArguments:
default=False,
metadata={"help": "Whether or not to disable CUDA graph in the vLLM engine."},
)
offload_folder: str = field(
default="offload",
metadata={"help": "Path to offload model weights."},
)
hf_hub_token: Optional[str] = field(
default=None,
metadata={"help": "Auth token to log in with Hugging Face Hub."},

View File

@ -291,6 +291,9 @@ def patch_config(
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
def patch_model(
model: "PreTrainedModel", tokenizer: "PreTrainedTokenizer", model_args: "ModelArguments", is_trainable: bool