Mistral-RAG is a refined fine-tuning of the Mistral-Ita-7b model, engineered specifically to enhance question and answer tasks. It features a unique dual-response capability, offering both generative and extractive modes to cater to a wide range of informational needs.
Capabilities
Generative Mode
Description:
The generative mode is designed for scenarios that require complex, synthesized responses. This mode integrates information from multiple sources and provides expanded explanations.
Ideal Use Cases:
Educational purposes
Advisory services
Creative scenarios where depth and detailed understanding are crucial
Extractive Mode
Description:
The extractive mode focuses on speed and precision. It delivers direct and concise answers by extracting specific data from texts.
Ideal Use Cases:
Factual queries in research
Legal contexts
Professional environments where accuracy and direct evidence are necessary
How to Use
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
device = torch.device("cuda"if torch.cuda.is_available() else"cpu")
MODEL_NAME = "DeepMount00/Mistral-RAG"
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, torch_dtype=torch.bfloat16).eval()
model.to(device)
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
defgenerate_answer(prompt, response_type="generativo"):
# Creazione del contesto e della domanda in base al tipo di rispostaif response_type == "estrattivo":
prompt = f"Rispondi alla seguente domanda in modo estrattivo, basandoti esclusivamente sul contesto.\n{prompt}"else:
prompt = f"Rispondi alla seguente domanda in modo generativo, basandoti esclusivamente sul contesto.\n{prompt}"# Preparazione del messaggio per il modello
messages = [
{"role": "user", "content": prompt},
]
model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(device)
generated_ids = model.generate(model_inputs, max_new_tokens=200, do_sample=True,
temperature=0.001, eos_token_id=tokenizer.eos_token_id)
decoded = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
return decoded[0].split("[/INST]", 1)[1].strip() if"[/INST]"in decoded[0] else"Errore nella generazione della risposta"# Esempio di utilizzo con la nuova funzionalità
contesto = """Venerdì più di 2.100 persone che vivono vicino a un vulcano in Indonesia sono state sfollate per i rischi legati a un’eruzione. Martedì infatti l’isola vulcanica di Ruang, che si trova circa 100 chilometri a nord di Sulawesi, ha cominciato a eruttare, producendo una colonna di fumo e ceneri che ieri ha raggiunto 1.200 metri di altezza. Le operazioni di evacuazione sono ancora in corso: complessivamente sono più di 11mila le persone a cui è stato detto di lasciare le proprie case. Gran parte di loro vive sulla vicina isola di Tagulandang, che in totale ha 20mila abitanti; potrebbe essere raggiunta non solo dalle ceneri vulcaniche e dai piroclasti, ma anche da un eventuale tsunami causato dalla caduta in mare di lava e rocce."""
domanda = "Perchè le persone sono evacuate dalle case?"
prompt = f"Contesto: {contesto}\nDomanda: {domanda}"
answer = generate_answer(prompt, "estrattivo")
print(answer)
Developer
[Michele Montebovi]
Runs of DeepMount00 Mistral-RAG on huggingface.co
32
Total runs
-2
24-hour runs
-4
3-day runs
-10
7-day runs
3
30-day runs
More Information About Mistral-RAG huggingface.co Model
Mistral-RAG huggingface.co is an AI model on huggingface.co that provides Mistral-RAG's model effect (), which can be used instantly with this DeepMount00 Mistral-RAG model. huggingface.co supports a free trial of the Mistral-RAG model, and also provides paid use of the Mistral-RAG. Support call Mistral-RAG model through api, including Node.js, Python, http.
Mistral-RAG huggingface.co is an online trial and call api platform, which integrates Mistral-RAG's modeling effects, including api services, and provides a free online trial of Mistral-RAG, you can try Mistral-RAG online for free by clicking the link below.
DeepMount00 Mistral-RAG online free url in huggingface.co:
Mistral-RAG is an open source model from GitHub that offers a free installation service, and any user can find Mistral-RAG on GitHub to install. At the same time, huggingface.co provides the effect of Mistral-RAG install, users can directly use Mistral-RAG installed effect in huggingface.co for debugging and trial. It also supports api for free installation.