KEMBAR78
Fix QA sample by ydshieh · Pull Request #16648 · huggingface/transformers · GitHub
Skip to content

Conversation

@ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Apr 7, 2022

What does this PR do?

Try to address the issue about PT_QUESTION_ANSWERING_SAMPLE discussed in the following 2 comments:

#16523 (comment)

#16523 (comment)

@ydshieh
Copy link
Collaborator Author

ydshieh commented Apr 7, 2022

@patrickvonplaten @sgugger

I would like to have a feedback to see if this is in good direction.

@sgugger make style will break the line into 2 lines. But when replacing the qa_target_start_index and qa_target_end_index by 14 & 15, it actually fits in one line. Should I use a shorter name like qa_target_start_idx or qa_start_index for example?

@ydshieh
Copy link
Collaborator Author

ydshieh commented Apr 7, 2022

cc @vumichien and @bhadreshpsavani to keep them updated

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 7, 2022

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

Comment on lines 210 to 212
>>> target_start_index, target_end_index = torch.tensor([{qa_target_start_index}]), torch.tensor(
... [{qa_target_end_index}]
... )
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should be on two separate lines since there is formatting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@ydshieh ydshieh marked this pull request as ready for review April 7, 2022 14:47
@ydshieh ydshieh changed the title [WIP] Fix QA sample Fix QA sample Apr 7, 2022
@ydshieh
Copy link
Collaborator Author

ydshieh commented Apr 7, 2022

I should do the same for TF_QUESTION_ANSWERING_SAMPLE. Currently just to have some feedbacks from you if any :-)

@ydshieh
Copy link
Collaborator Author

ydshieh commented Apr 8, 2022

I also changed TF_QUESTION_ANSWERING_SAMPLE.

Ran locally for Roberta and TFRoberta, and their doctest pass.

Ready for @sgugger to give a final look :-)

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.

Looks great, thanks!

@ydshieh ydshieh merged commit ab22966 into huggingface:main Apr 8, 2022
@ydshieh
Copy link
Collaborator Author

ydshieh commented Apr 8, 2022

@vumichien @bhadreshpsavani

Could you pull the latest change into the master/main branch of your local clone, rebase your working branch for this sprint, and check if the QA doc example can now pass the doctest, please? Thanks a lot!

@ydshieh ydshieh deleted the fix_qa_doc_sample branch April 8, 2022 13:34
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