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

Fix OPT doc tests #18365

Merged
merged 6 commits into from
Aug 1, 2022
Merged

Conversation

ArthurZucker
Copy link
Collaborator

What does this PR do?

Fixes the doctest for OPT by adding slight modifications.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jul 30, 2022

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

@ArthurZucker ArthurZucker requested a review from ydshieh July 30, 2022 07:37
@ydshieh
Copy link
Collaborator

ydshieh commented Jul 30, 2022

Hi @ArthurZucker Do you know why the expected value has extra ``` ? OPTForCausalLM has the same expected value, but it doesn't have test failure. Seems strange to me 😕

 1003         >>> # Generate
 1004         >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
 1005         >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
 Expected:
     "Hey, are you consciours? Can you talk to me?\nI'm not consciours, but I can talk to you."
     ```
 Got:
     "Hey, are you consciours? Can you talk to me?\nI'm not consciours, but I can talk to you."

@ArthurZucker
Copy link
Collaborator Author

Actually it seems that the automatic doc préparation that adds a line does not affect the TFOPTForCausalLM forward doc. Thus I removed the manually created example and defeated to using add_code_sample which worked in that case.
Now why does the add extra line does not work is another mystery and I could not setup a debugging instance to check that

@ydshieh
Copy link
Collaborator

ydshieh commented Jul 30, 2022

Thank you. I will check this on Monday.

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.

Thank you for the fix, @ArthurZucker ! LGTM, especially all tests pass now.
Let's wait an approval from some core maintainers.

Includ review
@ArthurZucker ArthurZucker requested a review from sgugger August 1, 2022 07:37
@ydshieh
Copy link
Collaborator

ydshieh commented Aug 1, 2022

Regarding the mystery , it is due to this line

``decoder_input_ids```

all ``decoder_input_ids``` of shape `(batch_size, sequence_length)`.

We can fix this in this PR too :-) It should be simply

`decoder_input_ids`

@ArthurZucker
Copy link
Collaborator Author

I forgot to change the name in the add_docstring will fix that

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!

@ArthurZucker ArthurZucker merged commit 1141371 into huggingface:main Aug 1, 2022
@ArthurZucker ArthurZucker deleted the fix_opt_doc_tests branch August 2, 2022 06:16
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.

4 participants