Instructions to use PhillipGre/llama2-7b-sctt-classification with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use PhillipGre/llama2-7b-sctt-classification with PEFT:
from peft import PeftModel from transformers import AutoModelForSequenceClassification base_model = AutoModelForSequenceClassification.from_pretrained("meta-llama/Llama-2-7b-chat-hf") model = PeftModel.from_pretrained(base_model, "PhillipGre/llama2-7b-sctt-classification") - Notebooks
- Google Colab
- Kaggle
Llama-2-7b-chat-hf SCTT Creativity Classifier
A LoRA fine-tuned Llama-2-7b-chat-hf model for pairwise creativity ranking using sequence classification.
Model Details
- Base model:
meta-llama/Llama-2-7b-chat-hf - Fine-tuning method: LoRA (PEFT) via curriculum learning (SCTT β 3 phases, 10 epochs)
- Task: 3-class pairwise classification β predict which of two responses (A / B / Equal) is more creative
- Labels:
0=A,1=B,2=Equal
ELO Ranking Results
Pairwise classification outputs are converted into continuous creativity scores via an adaptive ELO rating system. For each item (prompt), all response pairs are repeatedly sampled and the classifier's A/B/Equal verdict drives standard ELO updates with tie support. A linearly decaying K-factor (high β low) ensures fast initial separation followed by stable convergence. Iteration stops when Pearson r against human ground-truth plateaus (patience-based early stopping). The final ELO ratings are min-max normalised to [0, 1] per item.
The choice of ranking algorithm is flexible. Any ranking method will work as long as it consumes this model's pairwise classification outputs (A/B/Equal) as input.
| Split | Pearson r | RMSE | Avg Rounds |
|---|---|---|---|
| Train | 0.9822 | 0.098 | 27.8 |
| Val | 0.6861 | 0.176 | 24.7 |
| Test | 0.6995 | 0.169 | 29.3 |
| Holdout | 0.5200 | 0.184 | 31.0 |
Usage
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
from peft import PeftModel
tokenizer = AutoTokenizer.from_pretrained("PhillipGre/llama2-7b-sctt-classification")
base_model = AutoModelForSequenceClassification.from_pretrained(
"meta-llama/Llama-2-7b-chat-hf",
num_labels=3,
torch_dtype=torch.bfloat16,
device_map="auto",
)
base_model.resize_token_embeddings(len(tokenizer))
base_model.config.pad_token_id = tokenizer.pad_token_id
model = PeftModel.from_pretrained(base_model, "PhillipGre/llama2-7b-sctt-classification")
model = model.merge_and_unload()
model.eval()
prompt = "experiment: testing bird's understanding of human speech\nA: response one\nB: response two"
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=180)
with torch.no_grad():
logits = model(**inputs).logits
label_map = {0: "A", 1: "B", 2: "Equal"}
print(label_map[logits.argmax().item()])
- Downloads last month
- 10
Model tree for PhillipGre/llama2-7b-sctt-classification
Base model
meta-llama/Llama-2-7b-chat-hf