transformers
5c9bde36 - [distributed] Run the sequence parallel tests on every causal language model

Commit
7 hours ago
[distributed] Run the sequence parallel tests on every causal language model `SequenceParallelTesterMixin` joins the bases of `CausalLMModelTest`, next to the FSDP and tensor parallel mixins: every causal language model test class loads its tester's tiny config with `sp_size=2` on 2 CPU ranks, and compares the logits of this rank's slice, the loss and every gradient with the same weights on the whole sequences, plain, packed (`position_ids` restart mid-sequence) and padded (a 2D `attention_mask`, and a length the ranks cannot split evenly). A tester config is only changed when the sequence parallel checks refuse it and the change is harmless: the auxiliary load-balancing loss of the MoE models is turned off. A model the checks still refuse is loaded with `sp_size=2` on both ranks and has to raise `ValueError`; the test then skips with the reason. The allow list starts with 7 model types; set `SEQUENCE_PARALLEL_TEST_MODEL_TYPES = None` to run every causal language model. `_deterministic_init_model_dir` and `_distributed_tmpdir` move from the FSDP mixin to `distributed_testing_utils`, and take the model class to build.
Author
Committer
Parents
Loading