Views
No views yet
| ID | Label |
|---|---|
| 0 | negative |
| 1 | neutral |
| 2 | positive |
| Metric | Baseline | Fine-tuned |
|---|---|---|
| Macro F1 | 0.814 | 0.947 |
| Accuracy | ~0.77 | ~0.89 |
1from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
2from peft import PeftModel
3import torch
4
5MODEL_ID = 'MBZUAI-Paris/Nile-Chat-4B'
6REPO_ID = 'nancyahmed114/arabizi-sentiment-lora-nilechat2'
7
8bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type='nf4',
9 bnb_4bit_compute_dtype=torch.bfloat16)
10base = AutoModelForCausalLM.from_pretrained(MODEL_ID, quantization_config=bnb, device_map='auto')
11model = PeftModel.from_pretrained(base, REPO_ID)
12tok = AutoTokenizer.from_pretrained(REPO_ID)