Instructions to use yashAI007/Bhagavat_Gita with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use yashAI007/Bhagavat_Gita with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/llama-3.2-3b-instruct-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "yashAI007/Bhagavat_Gita") - Transformers
How to use yashAI007/Bhagavat_Gita with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yashAI007/Bhagavat_Gita") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("yashAI007/Bhagavat_Gita", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yashAI007/Bhagavat_Gita with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yashAI007/Bhagavat_Gita" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yashAI007/Bhagavat_Gita", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yashAI007/Bhagavat_Gita
- SGLang
How to use yashAI007/Bhagavat_Gita with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "yashAI007/Bhagavat_Gita" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yashAI007/Bhagavat_Gita", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "yashAI007/Bhagavat_Gita" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yashAI007/Bhagavat_Gita", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use yashAI007/Bhagavat_Gita with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for yashAI007/Bhagavat_Gita to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for yashAI007/Bhagavat_Gita to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for yashAI007/Bhagavat_Gita to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="yashAI007/Bhagavat_Gita", max_seq_length=2048, ) - Docker Model Runner
How to use yashAI007/Bhagavat_Gita with Docker Model Runner:
docker model run hf.co/yashAI007/Bhagavat_Gita
Model Card for Model ID
Model Details
Base Model
unsloth/Llama-3.2-3B-Instruct
Features
- Fine-tuned using Unsloth
- 4-bit quantization support
- PEFT / LoRA adapter
- Fast inference support
- Optimized for Colab and consumer GPUs
Installation & Guidance for Inference
!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
)
- Downloads last month
- 1