Skip to content

Commit

Permalink
Enforce max_memory for device_map strategies (#22311)
Browse files Browse the repository at this point in the history
Enforce  for device_map strategies
  • Loading branch information
sgugger committed Mar 23, 2023
1 parent 6828768 commit 62d9baa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2576,6 +2576,7 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
model,
dtype=torch_dtype,
low_zero=(device_map == "balanced_low_0"),
max_memory=max_memory,
**kwargs,
)
kwargs["max_memory"] = max_memory
Expand Down

0 comments on commit 62d9baa

Please sign in to comment.