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
[RAG] Propagating of n_docs as parameter to all RagModel's related functions #7891
[RAG] Propagating of n_docs as parameter to all RagModel's related functions #7891
Conversation
…hat defaults to self.config.n_docs
…ce type. T5PreTrainedModel do not have n_docs as parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides a small suggestion for the docstrings this PR looks great! Thanks a lot @lalitpagaria !
@lhoestq would be great if you can review as well |
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
@patrickvonplaten Thanks for the review. while working on this PR I found that in
So still issue can come when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me :)
|
It would be better if we mention it explicitly by assert. WDYT? |
Yes indeed. Also if |
Yes @lalitpagaria - it would be nice if you can add an asserte statement verifying that |
…s should be the same for both retriever and generator.
@patrickvonplaten @lhoestq Added assert at two places please verify, along with supporting unit test. Pardon my naming convention for test function, and please suggest proper name :)
This can't be check if |
…agSequenceForGeneration context_input_ids can be null
@patrickvonplaten and @lhoestq Thanks for the review. I liked the test coverage of this project. Initially I struggled but letter all worked nicely. You can merge when you want. |
Slow tests pass => ready to merge |
Good job @lalitpagaria ! |
…nctions (huggingface#7891) * Propagating n_docs as parameter to all RagModel's related functions that defaults to self.config.n_docs * Making n_docs parameter's default value to None in marginalize function * Fixing code quality issues * Handle the special case when generator is of T5PreTrainedModel instance type. T5PreTrainedModel do not have n_docs as parameter * T5PreTrainedModel do not have n_docs as parameter * Addressing review comment Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com> * Correcting comment by addressing review comment * Adding assert statement verifying that n_docs is correctly set. n_docs should be the same for both retriever and generator. * Fixing flake8 reported issue * Correcting test datasets for rag * Using doc_scores instead of context_input_ids to check assert as in RagSequenceForGeneration context_input_ids can be null * doc_scores second dimension have number of retrieved docs * Changing assert comment * Apply suggestions from code review Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
…lated functions (huggingface#7891)" This reverts commit 64a50cb.
What does this PR do?
Fixes #7874
Before submitting
Pull Request section?
to the it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors which may be interested in your PR.
@patrickvonplaten