Skip to content

Commit 646816a

Browse files
author
Shiqiang Wang
committed
Minor fixes and improvements
1 parent 99178ef commit 646816a

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

fms_fsdp/utils/dataloader_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ def get_data_loader(cfg, rank, world_size, postprocess=[causal_lm]):
8888
), f"File type {cfg.file_type} is not recognized ({list(_handler_map.keys())})"
8989
if cfg.file_type == "hf_parquet" or cfg.file_type == "auto":
9090
filehandler = _handler_map[cfg.file_type](cfg.tokenizer_path, cols)
91-
else:
92-
filehandler = _handler_map[cfg.file_type, cols]
91+
elif cfg.file_type == "arrow":
92+
filehandler = _handler_map[cfg.file_type](cols)
93+
9394
# Base reader layer
9495
data = StreamingDocDataset(
9596
cfg.data_path,

fms_fsdp/utils/dataset_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ def setup(self):
939939
# listdir, assemble shardfraglist (ind -> shard, frag)
940940
shards = [
941941
os.path.join(root, name)[len(datapath) + 1 :]
942-
for root, dirs, files in os.walk(datapath, topdown=False)
942+
for root, dirs, files in os.walk(datapath, topdown=False, followlinks=True)
943943
for name in files
944944
if self.filehandler.is_legal(os.path.join(root, name))
945945
]

fms_fsdp/utils/train_utils.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,27 @@ def train(
4343
import wandb # type: ignore
4444
except ImportError:
4545
raise ImportError("tracker is set to wandb but wandb is not installed.")
46+
# dist.barrier()
4647
if rank == 0:
47-
print(f"--> wandb is enabled!")
48+
print(f"--> Started initializing wandb", flush=True)
4849
try:
4950
wandb.init(
5051
project=project_name,
5152
dir=tracker_dir,
5253
resume="allow",
5354
id=run_id,
55+
# mode='offline',
56+
settings=wandb.Settings(
57+
init_timeout=3600,
58+
)
5459
)
5560
except wandb.errors.UsageError:
5661
raise ValueError(
5762
"wandb failed to init, did you pass your wandb api key via WANDB_API_KEY?"
5863
)
5964
wandb.config = asdict(cfg)
65+
print(f"--> wandb is enabled!", flush=True)
66+
# dist.barrier()
6067

6168
if cfg.tracker == "aim":
6269
try:
@@ -102,7 +109,7 @@ def train(
102109
if profiler:
103110
profiler.step()
104111

105-
if batch_idx % cfg.report_interval == 0:
112+
if batch_idx % cfg.report_interval == 0 or batch_idx == start_step + 1:
106113
dist.all_reduce(ddp_stats, op=dist.ReduceOp.SUM)
107114
train_loss = ddp_stats[0] / ddp_stats[2]
108115
g_norm = ddp_stats[1] / ddp_stats[2]
@@ -146,7 +153,7 @@ def train(
146153
"overall token per day:",
147154
int(new_tokens_seen / elapsed_time * 3600 * 24),
148155
)
149-
if cfg.tracker:
156+
if cfg.tracker and batch_idx > start_step + 1:
150157
vals_to_track = {
151158
"learning rate": current_lr,
152159
"loss": current_loss,

0 commit comments

Comments
 (0)