updated
Browse files
README.md
CHANGED
|
@@ -4,19 +4,67 @@ language:
|
|
| 4 |
- en
|
| 5 |
license: apache-2.0
|
| 6 |
tags:
|
| 7 |
-
-
|
| 8 |
- transformers
|
| 9 |
- unsloth
|
| 10 |
- mistral
|
| 11 |
- trl
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
-
# Uploaded
|
| 15 |
|
| 16 |
-
- **Developed by:**
|
| 17 |
-
- **License:**
|
| 18 |
-
- **Finetuned from model
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
- en
|
| 5 |
license: apache-2.0
|
| 6 |
tags:
|
| 7 |
+
- llm-finetuning
|
| 8 |
- transformers
|
| 9 |
- unsloth
|
| 10 |
- mistral
|
| 11 |
- trl
|
| 12 |
+
datasets:
|
| 13 |
+
- stanfordnlp/imdb
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# Uploaded Model
|
| 17 |
|
| 18 |
+
- **Developed by:** Shaheen Nabi
|
| 19 |
+
- **License:** Apache-2.0
|
| 20 |
+
- **Finetuned from model:** `unsloth/mistral-7b-bnb-4bit`
|
| 21 |
+
- **Model Type:** Large Language Model (LLM)
|
| 22 |
+
- **Training Framework:** Hugging Face Transformers, TRL (Transformers Reinforcement Learning) library
|
| 23 |
+
- **Pretraining Dataset:** [Stanford IMDb Dataset](https://huggingface.co/datasets/stanfordnlp/imdb)
|
| 24 |
+
- **Fine-Tuning Dataset:** Stanford IMDb (Text Classification Task)
|
| 25 |
|
| 26 |
+
### Overview
|
| 27 |
|
| 28 |
+
This model is a fine-tuned version of `unsloth/mistral-7b-bnb-4bit`, a 7-billion-parameter model based on the Mistral architecture. It was trained to improve performance on natural language understanding tasks, specifically for text classification using the Stanford IMDb dataset.
|
| 29 |
+
|
| 30 |
+
The fine-tuning process leveraged the **Unsloth** framework, which speeds up training times significantly, enabling a **2x faster training** process compared to traditional methods. Additionally, Hugging Face's **TRL library** (Transformers Reinforcement Learning) was used to adapt the model efficiently.
|
| 31 |
+
|
| 32 |
+
### Training Details
|
| 33 |
+
|
| 34 |
+
- **Base Model:** `unsloth/mistral-7b-bnb-4bit` (7B parameters, 4-bit quantized weights for memory efficiency)
|
| 35 |
+
- **Training Speed:** The model was trained **2x faster** with Unsloth, making it a more practical solution for large-scale fine-tuning.
|
| 36 |
+
- **Optimization Techniques:** Use of low-rank adaptation (LoRA), gradient checkpointing, and 4-bit quantization to reduce memory and computational cost while maintaining model performance.
|
| 37 |
+
|
| 38 |
+
### Intended Use
|
| 39 |
+
|
| 40 |
+
This model is intended for tasks like:
|
| 41 |
+
- Sentiment analysis
|
| 42 |
+
- Text classification
|
| 43 |
+
- Fine-grained NLP tasks
|
| 44 |
+
|
| 45 |
+
It is well-suited for environments with limited resources, thanks to the quantization of the base model and fine-tuning techniques employed.
|
| 46 |
+
|
| 47 |
+
### Model Performance
|
| 48 |
+
|
| 49 |
+
- **Primary Metric:** Accuracy on text classification tasks (Stanford IMDb dataset)
|
| 50 |
+
- **Fine-Tuning Results:** This fine-tuned model achieved a notable improvement in accuracy, making it suitable for deployment in real-world NLP applications.
|
| 51 |
+
|
| 52 |
+
### Usage
|
| 53 |
+
|
| 54 |
+
To use the model, you can directly load it using Hugging Face's Transformers library, with the following code:
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 58 |
+
|
| 59 |
+
model_name = "shaheennabi/your-finetuned-mistral-7b-imdb"
|
| 60 |
+
|
| 61 |
+
# Load the fine-tuned model
|
| 62 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 63 |
+
|
| 64 |
+
# Load tokenizer
|
| 65 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 66 |
+
|
| 67 |
+
# Example of using the model for inference
|
| 68 |
+
input_text = "This movie was fantastic!"
|
| 69 |
+
inputs = tokenizer(input_text, return_tensors="pt", padding=True, truncation=True)
|
| 70 |
+
outputs = model(**inputs)
|