Views
No views yet
meta-llama/Llama-3.2-1B-Instruct on the MNLI (Multi-Genre Natural Language Inference) dataset from GLUE.1from transformers import AutoTokenizer, AutoModelForSequenceClassification, BitsAndBytesConfig
2from peft import PeftModel
3import torch
4
5BASE = "meta-llama/Llama-3.2-1B-Instruct"
6ADAPTER = "streetelite/mnli-llama3.2-1b-qlora-10k"
7
8bnb = BitsAndBytesConfig(
9 load_in_4bit=True,
10 bnb_4bit_quant_type="nf4",
11 bnb_4bit_compute_dtype=torch.float16,
12 bnb_4bit_use_double_quant=True
13)
14
15tokenizer = AutoTokenizer.from_pretrained(ADAPTER)
16model = AutoModelForSequenceClassification.from_pretrained(
17 BASE,
18 num_labels=3,
19 quantization_config=bnb,
20 torch_dtype=torch.float16,
21 device_map="auto"
22)
23model = PeftModel.from_pretrained(model, ADAPTER).eval()
24
25inputs = tokenizer(
26 "A man is playing guitar.",
27 "A person is making music.",
28 return_tensors="pt",
29 truncation=True
30)
31with torch.inference_mode():
32 logits = model(**{k: v.to(model.device) for k, v in inputs.items()}).logits
33 probs = logits.softmax(-1)
34print(probs)| Set | Accuracy | F1 (macro) | F1 (weighted) | MCC | Kappa | MAE |
|---|---|---|---|---|---|---|
| Matched | 82.37% | 0.8210 | 0.8224 | 0.7358 | 0.7349 | 0.2068 |
| Mismatched | 83.71% | 0.8348 | 0.8360 | 0.7558 | 0.7550 | 0.1894 |
| Accuracy | F1 (macro) | F1 (weighted) | MCC | Kappa | MAE |
|---|---|---|---|---|---|
| 83.10% | 0.8280 | 0.8288 | 0.7496 | 0.7461 | 0.2010 |
q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj