transformers
c9161099 - Avoid eager torch.distributed.tensor.device_mesh import in continuous_batching

Commit
50 days ago
Avoid eager torch.distributed.tensor.device_mesh import in continuous_batching `from torch.distributed.tensor.device_mesh import DeviceMesh` at module top crashed at load time on torch versions that predate that submodule. Since the import bubbles up via `from transformers import AutoModelForCausalLM`, it broke test collection on older-torch CI matrices. `DeviceMesh` is only used as a type annotation. Express the type through the already-imported `torch.distributed` alias as a forward-reference string — `"dist.device_mesh.DeviceMesh | None"` — so the runtime never resolves it but type checkers can still infer it.
Author
Committer
Parents
Loading