Downloads · 30 days
15
9% of all-time downloads
jonathanjordan21/mt5-base-finetuned-RAG
mt5-base-finetuned-RAG is a text generation model from jonathanjordan21. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
Downloads · 30 days
15
9% of all-time downloads
All-time downloads
163
Public
Repo size
34.9 MB
Likes
0
Public
Click a slice to open those files.
.json16.3 MB · 59%
From the Hugging Face model README
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
The model generates answer to the question based on the given context. The model could tell if the question is unanswerable within the context.
There is an issue regarding the consistency of the output. Set temperature to 0 or very close to 0 to achieve more consistent output. Feel free to try to increase the top_k parameter to improve the output further
<|context|>
James Clerk Maxwell FRSE FRS (13 June 1831 – 5 November 1879) was a Scottish physicist with broad interests who was responsible for the classical theory of electromagnetic radiation, which was the first theory to describe electricity, magnetism and light as different manifestations of the same phenomenon. Maxwell's equations for electromagnetism have been called the "second great unification in physics" where the first one had been realised by Isaac Newton.
With the publication of "A Dynamical Theory of the Electromagnetic Field" in 1865, Maxwell demonstrated that electric and magnetic fields travel through space as waves moving at the speed of light. He proposed that light is an undulation in the same medium that is the cause of electric and magnetic phenomena.[4] The unification of light and electrical phenomena led to his prediction of the existence of radio waves. Maxwell is also regarded as a founder of the modern field of electrical engineering.
<|user|>
Who is James Clerk Maxwell?
<|assistant|>
!pip install -U transformers
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model = AutoModelForSeq2SeqLM.from_pretrained("jonathanjordan21/mt5-base-finetuned-RAG")
tokenizer = AutoTokenizer.from_pretrained("jonathanjordan21/mt5-base-finetuned-RAG")
prompt_template = lambda c,q,a : f"<|context|>\n{c}\n<|user|>\n{q}\n<|assistant|>\n{a}"
ctx = """James Clerk Maxwell FRSE FRS (13 June 1831 – 5 November 1879) was a Scottish physicist with broad interests who was responsible for the classical theory of electromagnetic radiation, which was the first theory to describe electricity, magnetism and light as different manifestations of the same phenomenon. Maxwell's equations for electromagnetism have been called the "second great unification in physics" where the first one had been realised by Isaac Newton.
With the publication of "A Dynamical Theory of the Electromagnetic Field" in 1865, Maxwell demonstrated that electric and magnetic fields travel through space as waves moving at the speed of light. He proposed that light is an undulation in the same medium that is the cause of electric and magnetic phenomena.[4] The unification of light and electrical phenomena led to his prediction of the existence of radio waves. Maxwell is also regarded as a founder of the modern field of electrical engineering.
"""
text = prompt_template(ctx, "who is james clerk maxwell?", "")
tokenizer.batch_decode(model.generate(**tokenizer([text], return_tensors='pt', add_special_tokens=False).to('cuda'), temperature=0, max_new_tokens=256, top_k=1000))