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

CI: separate step to download nltk files #32935

Merged
merged 3 commits into from
Aug 22, 2024
Merged

Conversation

gante
Copy link
Member

@gante gante commented Aug 22, 2024

What does this PR do?

Should fix #32667 : NLTK is complaining about parallelism. The parallelism stems from the pytest call, so we should get rid of the problem if we download the NLTK data in advance of the pytest call 🤗

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

test_command = ""
if self.command_timeout:
test_command = f"timeout {self.command_timeout} "
# junit familiy xunit1 is necessary to support splitting on test name or class name with circleci split
test_command += f"python3 -m pytest -rsfE -p no:warnings -o junit_family=xunit1 --tb=short --junitxml=test-results/junit.xml -n {self.pytest_num_workers} " + " ".join(pytest_flags)
test_command += f"python3 -m pytest -rsfE -p no:warnings --tb=short -o junit_family=xunit1 --junitxml=test-results/junit.xml -n {self.pytest_num_workers} " + " ".join(pytest_flags)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we reorder the flags, we can see that this is the same as L188-191 (removed in this PR)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

@gante gante requested a review from ydshieh August 22, 2024 11:50
gante added a commit to gante/transformers that referenced this pull request Aug 22, 2024
Comment on lines +125 to +127
# Examples special case: we need to download NLTK files in advance to avoid cuncurrency issues
if "examples" in self.name:
steps.append({"run": {"name": "Download NLTK files", "command": """python -c "import nltk; nltk.download('punkt', quiet=True)" """}})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much nicer solution :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Copy link
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are smart!

@gante gante merged commit 8b94d28 into huggingface:main Aug 22, 2024
22 checks passed
@gante gante deleted the bandaid_32667 branch August 22, 2024 13:17
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request Aug 30, 2024
* separate step to download nltk files

* duplicated

* rm comma
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request Aug 30, 2024
* separate step to download nltk files

* duplicated

* rm comma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run_summarization likely race condition creates flaky test_tensorflow_examples
5 participants