Skip to content

Commit b83daf9

Browse files
committed
fix
1 parent 2aa4254 commit b83daf9

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
@@ -3499,6 +3499,8 @@ def calculate_global_batch_sizes(per_device_batch_size, expansion_factor, num_de
34993499
self.hf_eval_split = "train"
35003500
if self.eval_interval > 0 and not self.hf_eval_split:
35013501
raise ValueError("Please specify hf_eval_split or set eval_interval to <=0.")
3502+
if self.grain_worker_count > 1:
3503+
raise ValueError("Only supports <= 1 for now, more workers results in duplicated data")
35023504
elif self.dataset_type == DatasetType.GRAIN:
35033505
if not self.grain_train_files and not self.grain_train_mixture_config_path:
35043506
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, # only supports <=1 for now, more workers results in duplicated data
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)