Skip to content

Commit 74993e3

Browse files
committed
feat: add sequence parallelism instructions and clean up imports
- Add bash script header and comments to `sp_fsdp_dense.sh` explaining how to enable sequence parallelism with ulysses_size - Remove duplicate `import os` statement in transformers.py for cleaner code - Fix minor formatting by removing extra blank line in transformers_utils.py
1 parent db97bb2 commit 74993e3

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1+
#!/bin/bash
2+
# To enabele sequence parallelism, please set ulysses_size > 1
3+
# device_mesh = DeviceMesh(
4+
# device_type="cuda",
5+
# mesh=np.arange(4).reshape(2, 2),
6+
# mesh_dim_names=("dp", "fsdp"),
7+
# ulysses_size=2,
8+
# )
9+
#
110
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --nproc_per_node=4 sp_fsdp_dense.py

src/twinkle/model/transformers/transformers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import contextlib
33
import os
44
import json
5-
import os
65
import re
76
from dataclasses import dataclass, field
87
from typing import Dict, Any, List, Literal, Callable

src/twinkle/utils/transformers_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ def get_modules_to_not_convert(model):
135135
res.append(n)
136136
return res if res else None
137137

138-
139138
def get_llm_model(model, *, model_meta=None, inner_backbone: bool = True):
140139
"""Best-effort extraction of the LLM module from a (possibly wrapped) model.
141140

0 commit comments

Comments
 (0)