Skip to content

Commit

Permalink
Fix race condition in tokenizer save
Browse files Browse the repository at this point in the history
  • Loading branch information
deepdelirious committed Jan 3, 2025
1 parent 042e743 commit 9ca96f8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion flux_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,14 @@ def train(args):
else:
t5xxl_max_token_length = args.t5xxl_max_token_length

flux_tokenize_strategy = strategy_flux.FluxTokenizeStrategy(t5xxl_max_token_length)
#Multiple writers makes things weird
if accelerator.is_local_main_process():
flux_tokenize_strategy = strategy_flux.FluxTokenizeStrategy(t5xxl_max_token_length)
accelerator.wait_for_everyone()
if not accelerator.is_local_main_process():
flux_tokenize_strategy = strategy_flux.FluxTokenizeStrategy(t5xxl_max_token_length)
accelerator.wait_for_everyone()

strategy_base.TokenizeStrategy.set_strategy(flux_tokenize_strategy)

# load clip_l, t5xxl for caching text encoder outputs
Expand Down

0 comments on commit 9ca96f8

Please sign in to comment.