Views
No views yet
| Model Name | Vocabulary Size | Description |
|---|---|---|
| Original phi-2 | 50,295 | BBPE (Byte-level BPE) |
| phi-2-ko | 66,676 | BBPE. Added Korean vocab and merges |
| Model | # of tokens | Tokens |
|---|---|---|
| Original phi-2 | 25 | [168, 243, 226, 167, 100, 230, 168, 94, 112, 23821, 226, 116, 35975, 112, 168, 100, 222, 167, 102, 242, 35975, 112, 168, 119, 97] |
| phi-2-ko | 6 | [57974, 51299, 50617, 51005, 52027, 51446] |
1{
2 "fp16": {
3 "enabled": "auto",
4 "loss_scale": 0,
5 "loss_scale_window": 1000,
6 "initial_scale_power": 16,
7 "hysteresis": 2,
8 "min_loss_scale": 1
9 },
10
11 "bf16": {
12 "enabled": "auto"
13 },
14
15 "optimizer": {
16 "type": "AdamW",
17 "params": {
18 "lr": "auto",
19 "betas": "auto",
20 "eps": "auto",
21 "weight_decay": "auto"
22 }
23 },
24
25 "scheduler": {
26 "type": "WarmupLR",
27 "params": {
28 "warmup_min_lr": "auto",
29 "warmup_max_lr": "auto",
30 "warmup_num_steps": "auto"
31 }
32 },
33
34 "zero_optimization": {
35 "stage": 2,
36 "allgather_partitions": true,
37 "allgather_bucket_size": 2e8,
38 "overlap_comm": true,
39 "reduce_scatter": true,
40 "reduce_bucket_size": 2e8,
41 "contiguous_gradients": true,
42 "cpu_offload": true
43 },
44
45 "gradient_accumulation_steps": "auto",
46 "gradient_clipping": "auto",
47 "train_batch_size": "auto",
48 "train_micro_batch_size_per_gpu": "auto"
49}batch_size: 2
num_epochs: 1
learning_rate: 3e-4
gradient_accumulation_steps: 8
lr_scheduler_type: "linear"
group_by_length: False1import torch
2from transformers import PhiForCausalLM, AutoModelForCausalLM, AutoTokenizer
3
4torch.set_default_device("cuda")
5
6# Load model and tokenizer
7model = AutoModelForCausalLM.from_pretrained("daekeun-ml/phi-2-ko-v0.1", torch_dtype="auto")
8tokenizer = AutoTokenizer.from_pretrained("daekeun-ml/phi-2-ko-v0.1", trust_remote_code=True)
9
10# Korean
11inputs = tokenizer("머신러닝은 ", return_tensors="pt", return_attention_mask=False)
12
13outputs = model.generate(**inputs, max_length=200)
14text = tokenizer.batch_decode(outputs)[0]
15print(text)
16
17# English
18inputs = tokenizer('''def print_prime(n):
19 """
20 Print all primes between 1 and n
21 """''', return_tensors="pt", return_attention_mask=False)
22
23outputs = model.generate(**inputs, max_length=200)
24text = tokenizer.batch_decode(outputs)[0]
25print(text)