Instructions to use archanaachu776/sentiment-analyzer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use archanaachu776/sentiment-analyzer with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/gemma-2b") model = PeftModel.from_pretrained(base_model, "archanaachu776/sentiment-analyzer") - Transformers
How to use archanaachu776/sentiment-analyzer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="archanaachu776/sentiment-analyzer")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("archanaachu776/sentiment-analyzer", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use archanaachu776/sentiment-analyzer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "archanaachu776/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": "archanaachu776/sentiment-analyzer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/archanaachu776/sentiment-analyzer
- SGLang
How to use archanaachu776/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 "archanaachu776/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": "archanaachu776/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 "archanaachu776/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": "archanaachu776/sentiment-analyzer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use archanaachu776/sentiment-analyzer with Docker Model Runner:
docker model run hf.co/archanaachu776/sentiment-analyzer
Sentiment Analyzer Model
Overview
This repository contains a Sentiment Analysis model fine-tuned using LoRA (Low-Rank Adaptation) on top of the Google Gemma-2B base model.
The model is designed to analyze text input and determine the sentiment polarity (positive, negative, or neutral).
The model is hosted on Hugging Face and uploaded using the huggingface_hub Python API.
Model Details
Model Description
- Developed by: Archana S
- Hugging Face Username:
archanaachu776 - Model type: Text Generation / Sentiment Analysis
- Language(s): English
- Base Model: google/gemma-2b
- Fine-tuning Method: PEFT (LoRA)
- Library: Transformers + PEFT
- License: Apache 2.0
- Finetuned from: google/gemma-2b
Model Sources
- Repository: https://huggingface.co/archanaachu776/sentiment-analyzer
- Base Model: https://huggingface.co/google/gemma-2b
Intended Uses
Direct Use
- Analyze sentiment of user reviews
- Customer feedback analysis
- Social media sentiment monitoring
- Text classification tasks requiring sentiment polarity
Downstream Use
- Can be integrated into chatbots
- Can be used in recommendation systems
- Can be extended for domain-specific sentiment analysis (e.g., product, finance, healthcare)
Out-of-Scope Use
- Not suitable for generating medical, legal, or financial advice
- Not trained for multilingual sentiment analysis
- Not designed for toxicity or hate-speech detection
Bias, Risks, and Limitations
- The model may reflect biases present in the training data
- Performance may vary for informal, slang-heavy, or sarcastic text
- Accuracy depends on the domain similarity to training data
Recommendations
Users should validate predictions before using them in critical decision-making systems and consider further fine-tuning for domain-specific applications.
How to Get Started
Installation
pip install transformers peft torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "archanaachu776/sentiment-analyzer"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
text = "The product quality is excellent and I am very happy."
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 1
Model tree for archanaachu776/sentiment-analyzer
Base model
google/gemma-2b