Instructions to use venkat1701/gemma-2b-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use venkat1701/gemma-2b-finetuned with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-2b-it-bnb-4bit") model = PeftModel.from_pretrained(base_model, "venkat1701/gemma-2b-finetuned") - Transformers
How to use venkat1701/gemma-2b-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="venkat1701/gemma-2b-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("venkat1701/gemma-2b-finetuned") model = AutoModelForCausalLM.from_pretrained("venkat1701/gemma-2b-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use venkat1701/gemma-2b-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "venkat1701/gemma-2b-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "venkat1701/gemma-2b-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/venkat1701/gemma-2b-finetuned
- SGLang
How to use venkat1701/gemma-2b-finetuned 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 "venkat1701/gemma-2b-finetuned" \ --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": "venkat1701/gemma-2b-finetuned", "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 "venkat1701/gemma-2b-finetuned" \ --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": "venkat1701/gemma-2b-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use venkat1701/gemma-2b-finetuned 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 venkat1701/gemma-2b-finetuned 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 venkat1701/gemma-2b-finetuned to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for venkat1701/gemma-2b-finetuned to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="venkat1701/gemma-2b-finetuned", max_seq_length=2048, ) - Docker Model Runner
How to use venkat1701/gemma-2b-finetuned with Docker Model Runner:
docker model run hf.co/venkat1701/gemma-2b-finetuned
Gemma 2B Fine-tuned with LoRA
This is a fine-tuned version of unsloth/gemma-2b-it-bnb-4bit using LoRA (Low-Rank Adaptation).
Model Details
- Base Model: unsloth/gemma-2b-it-bnb-4bit
- Method: LoRA fine-tuning with PEFT
- Quantization: 4-bit (via bitsandbytes)
- Framework: Transformers + PEFT
- Model Type: Causal Language Model
- Language: English
- License: Apache 2.0
Usage
Installation
pip install transformers peft torch accelerate bitsandbytes
Basic Inference
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Load tokenizer and base model
tokenizer = AutoTokenizer.from_pretrained("venkat1701/gemma-2b-finetuned")
base_model = AutoModelForCausalLM.from_pretrained(
"unsloth/gemma-2b-it-bnb-4bit",
device_map="auto",
trust_remote_code=True
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "venkat1701/gemma-2b-finetuned")
model.eval()
# Generate text
prompt = "Explain quantum computing in simple terms:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_length=256,
temperature=0.7,
top_p=0.9,
do_sample=True
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
Using Hugging Face Inference API
import requests
API_URL = "https://api-inference.huggingface.co/models/venkat1701/gemma-2b-finetuned"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
output = query({
"inputs": "Explain quantum computing:",
"parameters": {"max_length": 256, "temperature": 0.7}
})
print(output)
Deployment
The model includes a FastAPI server and Docker support for easy deployment. See the repository for deployment scripts.
Training Details
Training Data
[More Information Needed]
Training Procedure
Preprocessing [optional]
[More Information Needed]
Training Hyperparameters
- Training regime: [More Information Needed]
Speeds, Sizes, Times [optional]
[More Information Needed]
Evaluation
Testing Data, Factors & Metrics
Testing Data
[More Information Needed]
Factors
[More Information Needed]
Metrics
[More Information Needed]
Results
[More Information Needed]
Summary
Model Examination [optional]
[More Information Needed]
Environmental Impact
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
- Hardware Type: [More Information Needed]
- Hours used: [More Information Needed]
- Cloud Provider: [More Information Needed]
- Compute Region: [More Information Needed]
- Carbon Emitted: [More Information Needed]
Technical Specifications [optional]
Model Architecture and Objective
[More Information Needed]
Compute Infrastructure
[More Information Needed]
Hardware
[More Information Needed]
Software
[More Information Needed]
Citation [optional]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Glossary [optional]
[More Information Needed]
More Information [optional]
[More Information Needed]
Model Card Authors [optional]
[More Information Needed]
Model Card Contact
[More Information Needed]
Framework versions
- PEFT 0.18.0
- Downloads last month
- 2
Model tree for venkat1701/gemma-2b-finetuned
Base model
unsloth/gemma-2b-it-bnb-4bit