Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid race condition in convert text to mds script #1390

Merged
merged 9 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
dakinggg marked this conversation as resolved.
Show resolved Hide resolved
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
Loading