[RAG] RagSequenceForGeneration should not load "facebook/rag-token-nq" and RagTokenForGeneration also should not load "facebook/rag-sequence-nq"
See original GitHub issueEnvironment info
transformers
version: 3.3.1- Platform: Linux-4.19.112±x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.6.9
- PyTorch version (GPU?): 1.6.0+cu101 (False)
- Tensorflow version (GPU?): 2.3.0 (False)
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No
Who can help
Information
Model I am using (Bert, XLNet …): RAG
The problem arises when using:
- the official example scripts: (give details below)
The tasks I am working on is:
- an official GLUE/SQUaD task: (give the name)
To reproduce
Following usage of token and sequence models should not be allowed, it may give unintended result in forward pass-
# RagSequenceForGeneration with "facebook/rag-token-nq"
model = RagSequenceForGeneration.from_pretrained("facebook/rag-token-nq", retriever=retriever)
# RagTokenForGeneration with "facebook/rag-sequence-nq"
model = RagTokenForGeneration.from_pretrained("facebook/rag-sequence-nq", retriever=retriever)
Also please correct example at https://huggingface.co/transformers/master/model_doc/rag.html#ragsequenceforgeneration
Expected behavior
Above usage should throw exception because both the models are incompatible with the each other.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
RAG - Hugging Face
Retrieval-augmented generation (“RAG”) models combine the powers of ... Initializing with a config file does not load the weights associated with the model, ......
Read more >huggingface/transformers: RAG - Zenodo
The RAG model is a retrieval-augmented generation model that can be leveraged for question-answering tasks using RagTokenForGeneration or ...
Read more >Question Answering with RAG on a Custom Dataset - YouTube
I've been having some fun playing with Facebook's RAG system for Question Answering, trying to get ... Your browser can 't play this...
Read more >python/giguru/converse/haystack/generator/transformers.py
'facebook/rag-token-nq', 'facebook/rag-sequence-nq'. ... SEQUENCE: raise NotImplementedError("RagSequenceForGeneration is not implemented yet") # TODO: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @lalitpagaria , the models are different in generating the answers - the results are not unexpected 😃 If you take a closer look into the code you can see that both models expect the exact same weights, but have different generate() functions
@patrickvonplaten
I am seeing very weird behaviour. Various RAG generator and model combination giving me very different output. I am not able to understand why?
Check output of generators for “What is capital of Germany?” -
Output of above run is (it is consistent behaviour) -