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

Add a check regarding the number of occurrences of ``` #18389

Merged
merged 5 commits into from
Aug 1, 2022

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Aug 1, 2022

What does this PR do?

We have TFOPTForCausalLM doctest failed due to the wrong expected value. The file prepare_for_doc_test.py didn't change that model file. It comes from the existence of ``decoder_input_ids```.

This PR adds a check, and also fixes all problematic places found with this new check.

@@ -92,6 +92,9 @@ def process_doc_file(code_file, add_new_line=True):

# fmt: off
splits = code.split("```")
if len(splits) % 2 != 1:
raise ValueError("The number of occurrences of ``` should be an even number.")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Even number doesn't guarantee the correctness, but odd number definitely means something is wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(well, at least for almost all the cases in our model and doc files)

@ydshieh ydshieh requested a review from sgugger August 1, 2022 08:54
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 1, 2022

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

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for fixing all of those!

@ydshieh ydshieh merged commit bd6d1b4 into huggingface:main Aug 1, 2022
@ydshieh ydshieh deleted the add_check_in_process_doc_file branch September 7, 2022 08:20
oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
…8389)

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
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