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.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for rajaganaa/mistral7b-imdb-sentiment

Finetuned
(605)
this model

Dataset used to train rajaganaa/mistral7b-imdb-sentiment