The model is a
uncased
model, which means that capital letters are simply converted to lower-case letters.
The model consists of a
question_encoder
,
retriever
and a
generator
. The retriever extracts relevant passages from the
wiki_dpr
train
datasets, which is linked above.
The question_encoder and retriever are based on
facebook/dpr-question_encoder-single-nq-base
and
facebook/bart-large
, which were jointly finetuned on
on the
wiki_dpr
QA dataset in an end-to-end fashion.
Usage:
Note
: In the usage example below only the
dummy
retriever of
wiki_dpr
is used because the complete
lecagy
index requires over 75 GB of RAM.
The model can generate answers to any factoid question as follows:
from transformers import RagTokenizer, RagRetriever, RagTokenForGeneration
tokenizer = RagTokenizer.from_pretrained("facebook/rag-token-nq")
retriever = RagRetriever.from_pretrained("facebook/rag-token-nq", index_name="exact", use_dummy_dataset=True)
model = RagTokenForGeneration.from_pretrained("facebook/rag-token-nq", retriever=retriever)
input_dict = tokenizer.prepare_seq2seq_batch("who holds the record in 100m freestyle", return_tensors="pt")
generated = model.generate(input_ids=input_dict["input_ids"])
print(tokenizer.batch_decode(generated, skip_special_tokens=True)[0])
# should give michael phelps => sounds reasonable
Runs of facebook rag-token-nq on huggingface.co
26.5K
Total runs
0
24-hour runs
8
3-day runs
-487
7-day runs
-340
30-day runs
More Information About rag-token-nq huggingface.co Model
rag-token-nq huggingface.co is an AI model on huggingface.co that provides rag-token-nq's model effect (), which can be used instantly with this facebook rag-token-nq model. huggingface.co supports a free trial of the rag-token-nq model, and also provides paid use of the rag-token-nq. Support call rag-token-nq model through api, including Node.js, Python, http.
rag-token-nq huggingface.co is an online trial and call api platform, which integrates rag-token-nq's modeling effects, including api services, and provides a free online trial of rag-token-nq, you can try rag-token-nq online for free by clicking the link below.
facebook rag-token-nq online free url in huggingface.co:
rag-token-nq is an open source model from GitHub that offers a free installation service, and any user can find rag-token-nq on GitHub to install. At the same time, huggingface.co provides the effect of rag-token-nq install, users can directly use rag-token-nq installed effect in huggingface.co for debugging and trial. It also supports api for free installation.