Skip to content

Commit

Permalink
Avoid race condition in convert text to mds script (#1390)
Browse files Browse the repository at this point in the history
  • Loading branch information
dakinggg authored Jul 23, 2024
1 parent 221d3e2 commit 7b160fc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions llmfoundry/command_utils/data_prep/convert_text_to_mds.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ def convert_text_to_mds(
reprocess (bool): Whether to always reprocess the given folder of text files
trust_remote_code (bool): If true, allows custom code to be executed to load the tokenizer
"""
# Load the tokenizer once on the main process so that the files are cached to avoid race conditions
# in the Hugging Face load code
AutoTokenizer.from_pretrained(
tokenizer_name,
trust_remote_code=trust_remote_code,
)

is_remote_output = is_remote_path(output_folder)
log.info(f'Output is remote: {is_remote_output}')

Expand Down

0 comments on commit 7b160fc

Please sign in to comment.