File size: 2,130 Bytes
225e5cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471c493
 
 
 
225e5cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163a188
 
 
225e5cc
 
 
 
 
 
 
163a188
225e5cc
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
license: other
language:
- en
pipeline_tag: text-generation
datasets:
- teknium/openhermes
---

# Model Card for Puffin-Phi V2

Phi-1.5 fine tuned with Hermes Dataset

## Model Details

### Model Sources

This model was trained on the OpenHermes Dataset, made by me, which is over 240,000 mostly GPT-4 generated synthetic datapoints

![image/png](https://cdn-uploads.huggingface.co/production/uploads/6317aade83d8d2fd903192d9/KFV00TWHS6E0z_l82QDxV.png)

![image/png](https://cdn-uploads.huggingface.co/production/uploads/6317aade83d8d2fd903192d9/8M5xBh_ixVxdtPQnDuCkV.png)

## Uses

Let me know!

## How to Get Started with the Model

Phi does not support device_map "auto", and does not seem to want to inference in fp16, so use bf16.

Here is working code to inference, though it can be improved:

```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

sysprompt = "The assistant gives helpful, detailed, and polite answers to the user's questions.\n"

model = AutoModelForCausalLM.from_pretrained("teknium/Puffin-Phi-v2", trust_remote_code=True, torch_dtype=torch.bfloat16).to("cuda")
tokenizer = AutoTokenizer.from_pretrained("teknium/Puffin-Phi-v2", trust_remote_code=True, torch_dtype=torch.bfloat16)
inputs = tokenizer(f"{sysprompt}USER: Write a negative review for the website Twitter.\nASSISTANT:", return_tensors="pt", return_attention_mask=False)
outputs = model.generate(**inputs, max_length=128, do_sample=True, temperature=0.2, top_p=0.9, use_cache=True, repetition_penalty=1.2, eos_token_id=tokenizer.eos_token_id)
text = tokenizer.batch_decode(outputs)[0]
print(text)
```

The prompt format is ShareGPT/Vicuna, so it uses the sysprompt (defualt in sysprompt variable)
then is prompted like so:

```
### Instruction:
<prompt>
### Response:
```  

## Training Details

### Training Procedure 

Trained with Axolotl. View the wandb runs for all my puffin runs (this is puffin-phi-4 on wandb):
https://wandb.ai/teknium1/hermes-phi/runs/hermes-phi-1

## Evaluation

![image/png](https://cdn-uploads.huggingface.co/production/uploads/6317aade83d8d2fd903192d9/sQqgzk6dM7mxbyVloFMa1.png)