Downloads · 30 days
5
7% of all-time downloads
Gautamo1/mistral-7b-rag-reader
mistral-7b-rag-reader is a machine learning model from Gautamo1. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Fine-tuned from mistralai/Mistral-7B-Instruct-v0.1 using QLoRA on a RAG reader dataset.
Downloads · 30 days
5
7% of all-time downloads
All-time downloads
68
Public
Parameters
7.2B
29 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors29 GB · 100%
From the Hugging Face model README
Fine-tuned from mistralai/Mistral-7B-Instruct-v0.1 using QLoRA on a RAG reader dataset.
Given a retrieved context chunk and a question, generate a grounded answer using only the information present in the context.
mistralai/Mistral-7B-Instruct-v0.1from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import torch
model = AutoModelForCausalLM.from_pretrained(
"Gautamo1/mistral-7b-rag-reader",
torch_dtype=torch.bfloat16,
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained("Gautamo1/mistral-7b-rag-reader")
messages = [
{"role": "system", "content": "Answer using ONLY the context provided."},
{"role": "user", "content": "Context:\n{chunk}\n\nQuestion: {question}"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=250, do_sample=False)
answer = tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(answer)
Generated from PDF documents using a multi-step pipeline: PDF parsing → question generation → answer generation → hard negative mining → quality filtering.