Downloads · 30 days
23
20% of all-time downloads
Sudhanshu1985/gemma-2-2b-qlora-Lawdataset
gemma-2-2b-qlora-Lawdataset is a machine learning model from Sudhanshu1985. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as gemma.
QLoRA (4-bit + LoRA) fine-tune of google/gemma-2-2b on a legal/financial instruction (Q&A) dataset. This repo holds the LoRA adapter.
Downloads · 30 days
23
20% of all-time downloads
All-time downloads
117
Public
Repo size
122 MB
Likes
0
Public
Click a slice to open those files.
.safetensors83.1 MB · 68%
From the Hugging Face model README
QLoRA (4-bit + LoRA) fine-tune of google/gemma-2-2b
on a legal/financial instruction (Q&A) dataset. This repo holds the LoRA adapter.
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
base = AutoModelForCausalLM.from_pretrained(
"google/gemma-2-2b", torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, "Sudhanshu1985/gemma-2-2b-qlora-Lawdataset")
tok = AutoTokenizer.from_pretrained("Sudhanshu1985/gemma-2-2b-qlora-Lawdataset")
msgs = [{"role": "user", "content": "Your question here"}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=256)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))
Provided under the Gemma Terms of Use.