File size: 3,601 Bytes
7404afa 494e523 54a0dfe d43caa6 494e523 d43caa6 54a0dfe 7404afa d43caa6 b876c81 d43caa6 7404afa d43caa6 7404afa d43caa6 7404afa d43caa6 7404afa d43caa6 7404afa d43caa6 7404afa d43caa6 7404afa d43caa6 7404afa d43caa6 7404afa d43caa6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
---
language:
- en
- id
- ms
license: apache-2.0
library_name: transformers
datasets:
- neural-bridge/rag-dataset-12000
- neural-bridge/rag-hallucination-dataset-1000
pipeline_tag: text2text-generation
---
## Model Details
### Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
- **Developed by:** Jonathan Jordan
- **Funded by:** Lintas Media Danawa
- **Model type:** MT5
- **Language(s) (NLP):** English
- **Finetuned from model :** gooogle/mt5-base
## Uses
The model generates answer to the question based on the given context. The model could tell if the question is unanswerable within the context.
### Note
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
### Prompt Template
```
<|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|>
```
### Direct Use
```
!pip install -U transformers
```
```python
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))
``` |