Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
|
3 |
+
# Doc / guide: https://huggingface.co/docs/hub/model-cards
|
4 |
+
{}
|
5 |
+
---
|
6 |
+
|
7 |
+
# Model Card for Phi 2 SlimOrca
|
8 |
+
|
9 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
10 |
+
|
11 |
+
Phi 2 finetuned on SlimOrca-Dedup. This model was trained with the goal of giving Phi 2 the ablity to generate the EOS token together with being capable of doing beam search. It can also follow custom system prompts as shown in the example below.
|
12 |
+
|
13 |
+
## Model Details
|
14 |
+
|
15 |
+
## How to Get Started with the Model
|
16 |
+
|
17 |
+
```python
|
18 |
+
import torch
|
19 |
+
import transformers
|
20 |
+
|
21 |
+
model = transformers.AutoModelForCausalLM.from_pretrained(
|
22 |
+
"miguelcarv/phi-2-slimorca",
|
23 |
+
trust_remote_code=True
|
24 |
+
)
|
25 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("microsoft/phi-2")
|
26 |
+
|
27 |
+
|
28 |
+
SYSTEM_PROMPT = "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."
|
29 |
+
input_text = f"""{SYSTEM_PROMPT}
|
30 |
+
|
31 |
+
Instruction: Give me the first 5 prime numbers and explain what prime numbers are.
|
32 |
+
Output:"""
|
33 |
+
|
34 |
+
with torch.no_grad():
|
35 |
+
outputs = model.generate(
|
36 |
+
tokenizer(input_text, return_tensors="pt")['input_ids'],
|
37 |
+
max_length=1024,
|
38 |
+
num_beams = 3,
|
39 |
+
eos_token_id = tokenizer.eos_token_id
|
40 |
+
)
|
41 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
42 |
+
```
|
43 |
+
|
44 |
+
## Training Details
|
45 |
+
|
46 |
+
- Trained for one epoch on SlimOrca-Dedup
|
47 |
+
- Learning rate: 1e-5
|
48 |
+
- Cosine learning rate decay to 0
|
49 |
+
- Optimizer: AdamW
|
50 |
+
- Batch size: 256
|
51 |
+
- Trained with mixed-precision bfloat16
|