huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
132.23k stars 26.34k forks source link

Adding RAG to text-generation pipeline #7777

Closed lalitpagaria closed 3 years ago

lalitpagaria commented 3 years ago

🚀 Feature request

Thank you for the awesome work. I am working on https://github.com/deepset-ai/haystack/issues/443 and just wanted to check whether any plan to add RAG into text-generation pipeline.

Motivation

text-generation already have other models, hence it I would be great to have it in there. And this will help keeping our code clean by not adding classes for each type of generators.

model = pipeline('text-generation', model="facebook/rag-token-nq", tokenizer=None, device=-1)
# ValueError: Unrecognized configuration class <class 'transformers.configuration_rag.RagConfig'> for this kind of AutoModel: AutoModelForCausalLM.
Model type should be one of CamembertConfig, XLMRobertaConfig, RobertaConfig, BertConfig, OpenAIGPTConfig, GPT2Config, TransfoXLConfig, XLNetConfig, XLMConfig, CTRLConfig, ReformerConfig, BertGenerationConfig.

Your contribution

If you guide me I am happy to help.

patrickvonplaten commented 3 years ago

Hey @lalitpagaria - RAG is quite different to other generation models so we don't have it on the short-term roadmap to add it to pipelines. We are still thinking about how to integrate retrieval augmented models to the pipelines.

lalitpagaria commented 3 years ago

Thanks @patrickvonplaten Yeah I totally agree with you. Please let me know whether I close this issue or keep it open for future reference.

patrickvonplaten commented 3 years ago

Leave it open - I'll put it under projects so that I don't forget it :-)

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

g-jing commented 3 years ago

@patrickvonplaten Great work! I noticed that transformers included the implementation for DPR. But for RAG, I only find a demo. Is there a source code for RAG? Or do you know where is Facebook's source code for RAG?

lhoestq commented 3 years ago

transformers does include RAG. You can even find the documentation here: https://huggingface.co/transformers/model_doc/rag.html