Skip to content

Commit df95a1f

Browse files
Merge pull request AI-Hypercomputer#4552 from CIeNET-International:emma/fix-multimodalsft
PiperOrigin-RevId: 954349551
2 parents e50e394 + fa28b05 commit df95a1f

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/maxtext/configs/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,6 +3546,8 @@ def calculate_global_batch_sizes(per_device_batch_size, expansion_factor, num_de
35463546
self.hf_eval_split = "train"
35473547
if self.eval_interval > 0 and not self.hf_eval_split:
35483548
raise ValueError("Please specify hf_eval_split or set eval_interval to <=0.")
3549+
if self.grain_worker_count > 1:
3550+
raise ValueError("Only supports <= 1 for now, more workers results in duplicated data")
35493551
elif self.dataset_type == DatasetType.GRAIN:
35503552
if not self.grain_train_files and not self.grain_train_mixture_config_path:
35513553
raise ValueError("When dataset_type=grain, please set grain_train_files or grain_train_mixture_config_path")

src/maxtext/input_pipeline/hf_data_processing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def vision_sft_preprocessing_pipeline(
181181
data_source=dataset,
182182
operations=operations,
183183
sampler=dummy_index_sampler,
184-
worker_count=1, # only supports <=1 for now, more workers results in duplicated data
184+
worker_count=config.grain_worker_count,
185185
worker_buffer_size=1,
186186
read_options=grain.ReadOptions(num_threads=1, prefetch_buffer_size=batch_size * 4),
187187
)
@@ -446,6 +446,7 @@ def make_hf_train_iterator(
446446
chat_template=config.chat_template,
447447
formatting_func_path=config.formatting_func_path,
448448
formatting_func_kwargs=config.formatting_func_kwargs,
449+
grain_worker_count=config.grain_worker_count,
449450
)
450451
return train_iter
451452

@@ -506,5 +507,6 @@ def make_hf_eval_iterator(
506507
chat_template=config.chat_template,
507508
formatting_func_path=config.formatting_func_path,
508509
formatting_func_kwargs=config.formatting_func_kwargs,
510+
grain_worker_count=config.grain_worker_count,
509511
)
510512
return eval_iter

0 commit comments

Comments
 (0)