Downloads · 30 days
5
24% of all-time downloads
konkani/mistral-7b-instruct-konkani-lora
mistral-7b-instruct-konkani-lora is a text generation model from konkani. Use it when you need the model to write or continue text. It is set up for peft.
A LoRA adapter that adapts togethercomputer/Mistral-7B-Instruct-v0.2 for Konkani.
Downloads · 30 days
5
24% of all-time downloads
All-time downloads
21
Public
Repo size
218 MB
Likes
0
Public
Click a slice to open those files.
.safetensors218 MB · 98%
From the Hugging Face model README
A LoRA adapter that adapts togethercomputer/Mistral-7B-Instruct-v0.2 for Konkani.
pip install torch transformers peft accelerate
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model = "togethercomputer/Mistral-7B-Instruct-v0.2"
adapter = "Reubencf/mistral-7b-instruct-konkani-lora"
tokenizer = AutoTokenizer.from_pretrained(adapter)
model = AutoModelForCausalLM.from_pretrained(
base_model,
torch_dtype=torch.float16,
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter)
model.eval()
messages = [
{"role": "user", "content": "तुजें नांव किदें?"},
]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
with torch.no_grad():
output = model.generate(
inputs,
max_new_tokens=256,
do_sample=True,
temperature=0.7,
top_p=0.9,
)
print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))
To fold the LoRA weights into the base model for faster inference:
merged = model.merge_and_unload()
merged.save_pretrained("mistral-7b-konkani-merged")
tokenizer.save_pretrained("mistral-7b-konkani-merged")
Uses the Mistral instruct chat template:
<s>[INST] your message [/INST]
tokenizer.apply_chat_template(...) (shown above) applies this for you.
| Base model | togethercomputer/Mistral-7B-Instruct-v0.2 |
| Type | LoRA (PEFT) |
| Rank (r) | 64 |
| Alpha | 128 |
| Dropout | 0.0 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Task | CAUSAL_LM |