Downloads · 30 days
8
21% of all-time downloads
nora-team/qwen-1.5b-grounded-lora
qwen-1.5b-grounded-lora is a text generation model from nora-team. Use it when you need the model to write or continue text. It is set up for peft.
This model is a fine-tuned version of Qwen/Qwen2.5-1.5B using LoRA adapters. It has been trained to generate accurate answers with proper source citations based on provided documents.
Downloads · 30 days
8
21% of all-time downloads
All-time downloads
38
Public
Repo size
85.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors73.9 MB · 82%
From the Hugging Face model README
This model is a fine-tuned version of Qwen/Qwen2.5-1.5B using LoRA adapters. It has been trained to generate accurate answers with proper source citations based on provided documents.
This model generates answers to questions by:
This model is designed for Question Answering tasks where you want:
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
# Load base model
base_model_name = "Qwen/Qwen2.5-1.5B"
base_model = AutoModelForCausalLM.from_pretrained(
base_model_name,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "sungmineom/qwen-1.5b-grounded-lora")
tokenizer = AutoTokenizer.from_pretrained("sungmineom/qwen-1.5b-grounded-lora")
# Prepare input
question = "What are the benefits of exercise?"
docs = [
{"title": "Health Benefits", "text": "Exercise improves cardiovascular health..."},
{"title": "Mental Health", "text": "Exercise reduces anxiety and depression..."}
]
doc_text = ""
for i, doc in enumerate(docs, 1):
doc_text += f"Document [{i}](Title: {doc['title']}): {doc['text']}\n"
prompt = f"""Instruction: Write an accurate, engaging, and concise answer for the given question using only the provided search results (some of which might be irrelevant) and cite them properly. Use an unbiased and journalistic tone. Always cite for any factual claim. When citing several search results, use [1][2][3]. Cite at least one document and at most three documents in each sentence. If multiple documents support the sentence, only cite a minimum sufficient subset of the documents.
Question: {question}
{doc_text}
Answer:"""
# Generate
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, top_p=0.9)
answer = tokenizer.decode(outputs[0], skip_special_tokens=True).split("Answer:")[-1].strip()
print(answer)
[More Information Needed]
[More Information Needed]
[More Information Needed]
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Use the code below to get started with the model.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]