Text Generation
Transformers
Safetensors
PEFT
English
sentiment-analysis
sentiment-classification
fine-tuned
lora
Instructions to use sanjay734/sentiment-analyzer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sanjay734/sentiment-analyzer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sanjay734/sentiment-analyzer")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("sanjay734/sentiment-analyzer", device_map="auto") - PEFT
How to use sanjay734/sentiment-analyzer with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sanjay734/sentiment-analyzer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sanjay734/sentiment-analyzer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sanjay734/sentiment-analyzer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sanjay734/sentiment-analyzer
- SGLang
How to use sanjay734/sentiment-analyzer 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 "sanjay734/sentiment-analyzer" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sanjay734/sentiment-analyzer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "sanjay734/sentiment-analyzer" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sanjay734/sentiment-analyzer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use sanjay734/sentiment-analyzer with Docker Model Runner:
docker model run hf.co/sanjay734/sentiment-analyzer
Sentiment Analyzer โ Gemma 2B LoRA
A small sentiment-analysis fine-tune of Google's Gemma 2B model using LoRA (PEFT).
This model was fine-tuned by Sanjay734 and uploaded to Hugging Face as:
sanjay734/sentiment-analyzer
Model Details
- Base model:
google/gemma-2b - Fine-tuning method: LoRA / PEFT
- Task: Sentiment classification
- Sentiment labels:
POSITIVE,NEGATIVE,NEUTRAL - Language: English
- Author: Sanjay734
- Hugging Face:
sanjay734
Fine-Tuning Setup
The model was loaded in 4-bit quantization to reduce GPU memory usage.
LoRA Configuration
r = 8lora_alpha = 16lora_dropout = 0.05task_type = CAUSAL_LM
Training Configuration
- Batch size per device:
2 - Maximum training steps:
50 - Learning rate:
2e-4 - Logging steps:
10 - FP16: enabled
Training Data
The fine-tuning dataset contains 8 example reviews:
- 3 positive examples
- 3 negative examples
- 2 neutral examples
Example:
Review: I love this product!
Sentiment: POSITIVE
Model tree for sanjay734/sentiment-analyzer
Base model
google/gemma-2b