Downloads · 30 days
3
8% of all-time downloads
yashAI007/Bhagavat_Gita
Bhagavat_Gita is a text generation model from yashAI007. Use it when you need the model to write or continue text. It is set up for peft.
Downloads · 30 days
3
8% of all-time downloads
All-time downloads
36
Public
Repo size
164 MB
Likes
0
Public
Click a slice to open those files.
.safetensors97.3 MB · 59%
From the Hugging Face model README
unsloth/Llama-3.2-3B-Instruct!pip install -q unsloth
# Install latest Unsloth
!pip install -q --force-reinstall --no-cache-dir git+https://github.com/unslothai/unsloth.git
!pip install --upgrade torchao>=0.16.0
%%capture
import os
if "COLAB_" not in "".join(os.environ.keys()):
!pip install unsloth
else:
!pip install --no-deps bitsandbytes accelerate xformers==0.0.29.post3 peft trl==0.15.2 triton cut_cross_entropy unsloth_zoo
!pip install sentencepiece protobuf "datasets>=3.4.1" huggingface_hub hf_transfer
!pip install --no-deps unsloth
from unsloth import FastLanguageModel
import torch
max_seq_length = 2048
dtype = None
load_in_4bit = True
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "unsloth/Llama-3.2-3B-Instruct",
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
)
model.load_adapter("YOUR_LORA_PATH", "default")
model.to("cuda")
model.enable_adapters()
messages = [
{
"role": "system",
"content": "You are a reflective assistant who is master in Bhagavad Gita for chapter 8."
},
{
"role": "user",
"content": "What does Krishna call Karma in this chapter?"
}
]
FastLanguageModel.for_inference(model)
inputs = tokenizer.apply_chat_template(
messages,
tokenize = True,
add_generation_prompt = True,
return_tensors = "pt",
).to("cuda")
from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer)
_ = model.generate(
input_ids = inputs,
streamer = text_streamer,
max_new_tokens = 2048,
do_sample = True,
temperature = 0.3,
top_p = 0.9
)