Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5135,6 +5135,9 @@ def caching_allocator_warmup(model: PreTrainedModel, expanded_device_map: dict,
# This causes the warmup function to return a `RuntimeError: Invalid buffer size: XX.XX GiB`.
# NOTE: not tested on intel macs
continue
elif device.type == "neuron":
# Skip warmup on Neuron (AWS Trainium/Inferentia): it provides no benefit as there is no reusable memory pool
continue
# We divide by 2 here as we allocate in fp16
_ = torch.empty(int(byte_count // 2), dtype=torch.float16, device=device, requires_grad=False)

Expand Down
Loading