Downloads · 30 days
82
4% of all-time downloads
RichardErkhov/DeepMount00_-_Mistral-RAG-gguf
DeepMount00_-_Mistral-RAG-gguf is a machine learning model from RichardErkhov. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
82
4% of all-time downloads
All-time downloads
2K
Public
Repo size
82.2 GB
Likes
0
Public
Click a slice to open those files.
.gguf95.2 GB · 100%
From the Hugging Face model README
Quantization made by Richard Erkhov.
Mistral-RAG - GGUF
| Name | Quant method | Size |
|---|---|---|
| Mistral-RAG.Q2_K.gguf | Q2_K | 2.53GB |
| Mistral-RAG.IQ3_XS.gguf | IQ3_XS | 2.81GB |
| Mistral-RAG.IQ3_S.gguf | IQ3_S | 2.96GB |
| Mistral-RAG.Q3_K_S.gguf | Q3_K_S | 2.95GB |
| Mistral-RAG.IQ3_M.gguf | IQ3_M | 3.06GB |
| Mistral-RAG.Q3_K.gguf | Q3_K | 3.28GB |
| Mistral-RAG.Q3_K_M.gguf | Q3_K_M | 3.28GB |
| Mistral-RAG.Q3_K_L.gguf | Q3_K_L | 3.56GB |
| Mistral-RAG.IQ4_XS.gguf | IQ4_XS | 3.67GB |
| Mistral-RAG.Q4_0.gguf | Q4_0 | 3.83GB |
| Mistral-RAG.IQ4_NL.gguf | IQ4_NL | 3.87GB |
| Mistral-RAG.Q4_K_S.gguf | Q4_K_S | 3.86GB |
| Mistral-RAG.Q4_K.gguf | Q4_K | 4.07GB |
| Mistral-RAG.Q4_K_M.gguf | Q4_K_M | 4.07GB |
| Mistral-RAG.Q4_1.gguf | Q4_1 | 4.24GB |
| Mistral-RAG.Q5_0.gguf | Q5_0 | 4.65GB |
| Mistral-RAG.Q5_K_S.gguf | Q5_K_S | 4.65GB |
| Mistral-RAG.Q5_K.gguf | Q5_K | 4.78GB |
| Mistral-RAG.Q5_K_M.gguf | Q5_K_M | 4.78GB |
| Mistral-RAG.Q5_1.gguf | Q5_1 | 5.07GB |
| Mistral-RAG.Q6_K.gguf | Q6_K | 5.53GB |
| Mistral-RAG.Q8_0.gguf | Q8_0 | 7.17GB |
library_name: transformers license: apache-2.0 datasets:
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.
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)
def generate_answer(prompt, response_type="generativo"):
# Creazione del contesto e della domanda in base al tipo di risposta
if 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)
[Michele Montebovi]