Skip to content

Fix doctest files fetch issue#23277

Merged
ydshieh merged 8 commits into
mainfrom
revert-23271-revert-23245-revert-22987-doct-tests
May 11, 2023
Merged

Fix doctest files fetch issue#23277
ydshieh merged 8 commits into
mainfrom
revert-23271-revert-23245-revert-22987-doct-tests

Conversation

@ydshieh

@ydshieh ydshieh commented May 10, 2023

Copy link
Copy Markdown
Collaborator

Reverts #23271

Embarrassingly and unfortunately, the new job tests_pr_documientation_tests fails at the step Get files to test when the job is run on the main branch.

https://app.circleci.com/pipelines/github/huggingface/transformers/64235/workflows/54a99003-258e-4c2a-8366-b4461b3ec33f/jobs/794628/parallel-runs/0/steps/0-113

I will have to take a look - the log is not informative.

@ydshieh
ydshieh requested a review from sgugger May 10, 2023 20:43
@HuggingFaceDocBuilderDev

HuggingFaceDocBuilderDev commented May 10, 2023

Copy link
Copy Markdown

The documentation is not available anymore as the PR was closed or merged.

@sgugger

sgugger commented May 10, 2023

Copy link
Copy Markdown
Collaborator

As said offline I don't think we need to revert urgently, we can just ignore the red check on main.

Comment thread .circleci/create_circleci_config.py Outdated
Comment on lines 455 to 456

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is the stuff that probably needs to be different on main vs a PR branch. The test fetcher has this test that can be reused/adapted.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The problems comes from the fact grep gives exit code 1 if the input is empty.

circleci@9576b4afebd1:~/transformers$ echo "" | grep -E '\.(mdx)$'
circleci@9576b4afebd1:~/transformers$ echo $?
1

Considering the chain of 3 grep in the 2nd line here, I think it's best to have a python function to do things.

@ydshieh
ydshieh force-pushed the revert-23271-revert-23245-revert-22987-doct-tests branch from 67a269a to 7ccebe6 Compare May 11, 2023 07:52
@ydshieh ydshieh changed the title Revert "Bring back the PR Refactor doctests + add CI to main" Fix doctest files fetch issue May 11, 2023
Comment thread .circleci/create_circleci_config.py Outdated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

put the logic to some new functions in utils/tests_fetcher.py.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That's cleaner thanks!

Comment thread utils/tests_fetcher.py Outdated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

just copies of existing functions with some modifications for doctest test files.

@ydshieh
ydshieh requested a review from sgugger May 11, 2023 10:00
@ydshieh
ydshieh force-pushed the revert-23271-revert-23245-revert-22987-doct-tests branch from e8ee1c1 to 863dcf5 Compare May 11, 2023 10:47
@ydshieh

ydshieh commented May 11, 2023

Copy link
Copy Markdown
Collaborator Author

@sgugger FYI The doctest PR also has some problem running on our GitHub Actions runner. See error below.
I will take a look, but this PR could be merged (without fixing the following issue) once you think the changes are good.

_____ ERROR collecting src/transformers/generation/configuration_utils.py ______
import file mismatch:
imported module 'transformers.generation.configuration_utils' has this __file__ attribute:
  /transformers/src/transformers/generation/configuration_utils.py
which is not the same as the test file we want to collect:
  /__w/transformers/transformers/src/transformers/generation/configuration_utils.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules

@sgugger sgugger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the cleanup! I just have a question on why the dummy.py. Maybe the comment can be more explicit on why it's needed?

Comment thread .circleci/create_circleci_config.py Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That's cleaner thanks!

Comment thread .circleci/create_circleci_config.py Outdated
@ydshieh

ydshieh commented May 11, 2023

Copy link
Copy Markdown
Collaborator Author

@sgugger FYI The doctest PR also has some problem running on our GitHub Actions runner. See error below. I will take a look, but this PR could be merged (without fixing the following issue) once you think the changes are good.

_____ ERROR collecting src/transformers/generation/configuration_utils.py ______
import file mismatch:
imported module 'transformers.generation.configuration_utils' has this __file__ attribute:
  /transformers/src/transformers/generation/configuration_utils.py
which is not the same as the test file we want to collect:
  /__w/transformers/transformers/src/transformers/generation/configuration_utils.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules

@sgugger A short fix for this issue is given in the last commit.

The reason is the file conftest.py has this line from transformers.testing_utils import HfDoctestModule, HfDocTestParser added in #23271. However, the transformers is installed during docker image build, which is different from the one when the CI is run.

This change should be applied to other workflow file, but it's rare that we have such imports in the codebase. I will do it in a separate PR.

@sgugger

sgugger commented May 11, 2023

Copy link
Copy Markdown
Collaborator

Thanks for all the explanation!

@ydshieh

ydshieh commented May 11, 2023

Copy link
Copy Markdown
Collaborator Author

Going to merge as the failing tests are irrelevant and I have tried to re-run for a few times.

@ydshieh
ydshieh merged commit 6a6225b into main May 11, 2023
@ydshieh
ydshieh deleted the revert-23271-revert-23245-revert-22987-doct-tests branch May 11, 2023 15:14
gojiteji pushed a commit to gojiteji/transformers that referenced this pull request Jun 5, 2023
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
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.

3 participants