Instructions to use Kavi11/sentiment-analyzer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Kavi11/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, "Kavi11/sentiment-analyzer") - Transformers
How to use Kavi11/sentiment-analyzer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kavi11/sentiment-analyzer")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Kavi11/sentiment-analyzer", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kavi11/sentiment-analyzer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kavi11/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": "Kavi11/sentiment-analyzer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Kavi11/sentiment-analyzer
- SGLang
How to use Kavi11/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 "Kavi11/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": "Kavi11/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 "Kavi11/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": "Kavi11/sentiment-analyzer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Kavi11/sentiment-analyzer with Docker Model Runner:
docker model run hf.co/Kavi11/sentiment-analyzer
|
Download README.md from Kavi11/sentiment-analyzer: direct link, hf CLI and curl.
- Browser
- Download file 2.63 kB
-
https://huggingface.co/Kavi11/sentiment-analyzer/resolve/main/README.md
- Command line
-
hf download hf://Kavi11/sentiment-analyzer/README.md
-
curl -L -o README.md https://huggingface.co/Kavi11/sentiment-analyzer/resolve/main/README.md
2.63 kB
| base_model: google/gemma-2b | |
| library_name: peft | |
| pipeline_tag: text-generation | |
| tags: | |
| - base_model:adapter:google/gemma-2b | |
| - lora | |
| - qlora | |
| - peft | |
| - transformers | |
| # Gemma-2B LoRA Fine-Tuned Model | |
| This repository contains **LoRA adapter weights** fine-tuned on top of the **google/gemma-2b** base model. | |
| The model is optimized for lightweight deployment and efficient fine-tuning using **PEFT / QLoRA**, making it suitable for low-resource environments. | |
| --- | |
| ## Model Details | |
| ### Model Description | |
| - **Base model:** google/gemma-2b | |
| - **Fine-tuning method:** LoRA (Parameter-Efficient Fine-Tuning) | |
| - **Library:** PEFT + Hugging Face Transformers | |
| - **Pipeline type:** Text Generation | |
| - **Language:** English | |
| - **Model format:** LoRA adapter (not merged) | |
| This repository **does not contain full Gemma weights**. It provides adapter layers that must be loaded on top of the base Gemma-2B model. | |
| --- | |
| ### Model Type | |
| - Causal Language Model (Decoder-only Transformer) | |
| ### License | |
| - Same as base model: **Gemma License** | |
| (Users must comply with Google Gemma usage terms) | |
| ### Finetuned From | |
| - `google/gemma-2b` | |
| --- | |
| ## Intended Uses | |
| ### Direct Use | |
| This model can be used for: | |
| - Domain-specific text generation | |
| - Instruction-following tasks (depending on dataset) | |
| - Prototyping GenAI applications with limited compute | |
| ### Downstream Use | |
| - Can be further fine-tuned with additional LoRA adapters | |
| - Can be merged with base model for inference if required | |
| - Suitable for chatbots, assistants, or internal tools | |
| ### Out-of-Scope Use | |
| - High-risk domains (medical, legal, financial advice) | |
| - Fully autonomous decision-making systems | |
| - Tasks requiring multilingual or long-context reasoning beyond base model limits | |
| --- | |
| ## Bias, Risks, and Limitations | |
| - Inherits biases from the base Gemma-2B model and training data | |
| - Performance is highly dependent on the fine-tuning dataset | |
| - Not evaluated for safety-critical applications | |
| - LoRA adapters may underperform compared to full fine-tuning | |
| ### Recommendations | |
| - Validate outputs before production use | |
| - Add guardrails for sensitive or user-facing deployments | |
| - Perform task-specific evaluation before downstream use | |
| --- | |
| ## How to Get Started | |
| ### Loading the Model | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| from peft import PeftModel | |
| base_model = "google/gemma-2b" | |
| adapter_repo = "Kavi11/gemma-2b-lora" # update if needed | |
| tokenizer = AutoTokenizer.from_pretrained(base_model) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| base_model, | |
| device_map="auto" | |
| ) | |
| model = PeftModel.from_pretrained(model, adapter_repo) | |