Instructions to use rajaganaa/mistral7b-imdb-sentiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Local Apps Settings
- Unsloth Studio
How to use rajaganaa/mistral7b-imdb-sentiment 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 rajaganaa/mistral7b-imdb-sentiment 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 rajaganaa/mistral7b-imdb-sentiment to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for rajaganaa/mistral7b-imdb-sentiment to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="rajaganaa/mistral7b-imdb-sentiment", max_seq_length=2048, )
mistral7b-imdb-sentiment
A LoRA fine-tune of unsloth/mistral-7b-bnb-4bit for binary sentiment classification on movie reviews, trained on the IMDB dataset and reformatted as an instruction-style task rather than raw text continuation. Trained 2x faster with Unsloth and Hugging Face TRL.
Prompt format
The model expects reviews wrapped in this instruction template — it was trained to complete the ### Sentiment: line with either positive or negative:
```
Instruction:
Classify the sentiment of the following movie review as either positive or negative.
Review:
Sentiment:
```
Evaluation
Evaluated on 100 held-out examples from the IMDB test split (greedy decoding):
| Metric | Value |
|---|---|
| Accuracy | 0.99 |
| Labeled rate | 1.00 |
| Avg latency | 0.996 s |
| p50 / p95 latency | 1.012 s / 1.167 s |
| Avg throughput | 8.03 tok/s |
Note: this batch used the same shuffle seed as the periodic evaluation during training, so results may overlap with examples seen during eval checkpoints (no gradient updates occurred on them, but for a fully independent check, re-run evaluation on a different slice of the test set.)
Usage
```python from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained( model_name="rajaganaa/mistral7b-imdb-sentiment", max_seq_length=2048, load_in_4bit=True, ) FastLanguageModel.for_inference(model)
prompt = ( "### Instruction:\nClassify the sentiment of the following movie review " "as either positive or negative.\n\n" "### Review:\nThis movie was surprisingly touching and beautifully shot.\n\n" "### Sentiment:\n" ) inputs = tokenizer([prompt], return_tensors="pt").to("cuda") output = model.generate(**inputs, max_new_tokens=8) print(tokenizer.decode(output[0], skip_special_tokens=True)) ```
Training details
- Base model:
unsloth/mistral-7b-bnb-4bit(4-bit quantized) - Method: LoRA via TRL's
SFTTrainer - LoRA targets: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Framework: Unsloth + TRL + PEFT
Code
Training, evaluation, and a Gradio playground app for this model are on GitHub: rajaganaa/100-AI-Projects/05-Unsloth-Mistral-IMDB-Sentiment
This mistral model was trained 2x faster with Unsloth and Hugging Face's TRL library.
Model tree for rajaganaa/mistral7b-imdb-sentiment
Base model
unsloth/mistral-7b-bnb-4bit