Views
No views yet
meta-llama/Llama-2-7b-chat-hf0=A, 1=B, 2=Equal| 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 |
1import torch
2from transformers import AutoModelForSequenceClassification, AutoTokenizer
3from peft import PeftModel
4
5tokenizer = AutoTokenizer.from_pretrained("PhillipGre/llama2-7b-sctt-classification")
6base_model = AutoModelForSequenceClassification.from_pretrained(
7 "meta-llama/Llama-2-7b-chat-hf",
8 num_labels=3,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11)
12base_model.resize_token_embeddings(len(tokenizer))
13base_model.config.pad_token_id = tokenizer.pad_token_id
14
15model = PeftModel.from_pretrained(base_model, "PhillipGre/llama2-7b-sctt-classification")
16model = model.merge_and_unload()
17model.eval()
18
19prompt = "experiment: testing bird's understanding of human speech\nA: response one\nB: response two"
20inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=180)
21with torch.no_grad():
22 logits = model(**inputs).logits
23label_map = {0: "A", 1: "B", 2: "Equal"}
24print(label_map[logits.argmax().item()])