seawolf2357
commited on
Commit
•
d772f3e
1
Parent(s):
d9b2450
Upload 8 files
Browse files- .gitattributes +35 -35
- README.md +76 -74
- adapter_config.json +25 -0
- adapter_model.bin +3 -0
- added_tokens.json +3 -0
- special_tokens_map.json +6 -0
- tokenizer.model +3 -0
- tokenizer_config.json +34 -0
.gitattributes
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,74 +1,76 @@
|
|
1 |
-
---
|
2 |
-
license:
|
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 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
datasets:
|
6 |
+
- sl-alex/openai-prm800k-solutions-only
|
7 |
+
---
|
8 |
+
|
9 |
+
Finetunes Llama-7b+Alpaca to solve problems via stepwise reasoning (OpenAI [PRM800k dataset](https://github.com/openai/prm800k), or rather our postprocessed version, [`sl-alex/openai-prm800k-solutions-only`](https://huggingface.co/datasets/sl-alex/openai-prm800k-solutions-only)).
|
10 |
+
|
11 |
+
## Model description
|
12 |
+
|
13 |
+
This is a fork of [`llama-7b`](https://huggingface.co/huggyllama/llama-7b) + [`tloen/alpaca-lora-7b`](https://huggingface.co/tloen/alpaca-lora-7b).
|
14 |
+
|
15 |
+
That is: we loaded Llama-7b, we applied Alpaca LoRA, expanded vocabulary, then QLoRA 4-bit finetuned from there.
|
16 |
+
|
17 |
+
Parts:
|
18 |
+
|
19 |
+
- base model [`llama-7b`](https://huggingface.co/huggyllama/llama-7b)
|
20 |
+
- LoRA 0 [`tloen/alpaca-lora-7b`](https://huggingface.co/tloen/alpaca-lora-7b)
|
21 |
+
- LoRA 1
|
22 |
+
- `adapter_config.json`
|
23 |
+
- `adapter_model.bin`
|
24 |
+
- tokenizer (this is just [`llama-7b`](https://huggingface.co/huggyllama/llama-7b)'s tokenizer, plus a `[PAD]` token for which no embedding was learned. in practice you can inference a batch-of-1 using the original [`llama-7b`](https://huggingface.co/huggyllama/llama-7b) tokenizer instead)
|
25 |
+
- `added_tokens.json`
|
26 |
+
- `special_tokens_map.json`
|
27 |
+
- `tokenizer.model`
|
28 |
+
- `tokenizer_config.json`
|
29 |
+
|
30 |
+
## Training
|
31 |
+
|
32 |
+
Trained using [`qlora.py`](https://github.com/scottlogic-alex/qlora/blob/stepwise/qlora.py) from our [`stepwise`](https://github.com/scottlogic-alex/qlora/tree/stepwise) branch of [qlora](https://github.com/artidoro/qlora).
|
33 |
+
Known-good as of commit [`3a86919`](https://github.com/scottlogic-alex/qlora/blob/3a8691986b6718562bcd8e3522447b52842c1d9a/qlora.py).
|
34 |
+
|
35 |
+
`python -m qlora --model_name_or_path huggyllama/llama-7b --lora_name_or_path tloen/alpaca-lora-7b --dataset prm800k-solutions --dataset_format prm800k-solutions --bf16 --max_memory_MB 24000 --use_bos_token_in_prompt --truncate_toward_center --source_max_len 184 --target_max_len 998 --gradient_accumulation_steps 4 --per_device_train_batch_size 4 --per_device_eval_batch_size 4 --learning_rate 0.0002 --run_name 13b_alpaca_special_tokens_long --report_to wandb --save_steps 64 --save_total_limit 3 --max_steps 1664 --evaluation_strategy steps --eval_steps 64 --generate_steps 16`
|
36 |
+
|
37 |
+
## Usage
|
38 |
+
|
39 |
+
You can load using [`evaluate.py`](https://github.com/scottlogic-alex/qlora/blob/stepwise/evaluate.py#L209-L278) from our [`stepwise`](https://github.com/scottlogic-alex/qlora/tree/stepwise) branch of [qlora](https://github.com/artidoro/qlora).
|
40 |
+
Known-good as of commit [`3a86919`](https://github.com/scottlogic-alex/qlora/blob/3a8691986b6718562bcd8e3522447b52842c1d9a/evaluate.py).
|
41 |
+
|
42 |
+
```bash
|
43 |
+
git clone -b stepwise https://github.com/scottlogic-alex/qlora.git
|
44 |
+
cd qlora
|
45 |
+
python -m evaluate \
|
46 |
+
--model_name_or_path huggyllama/llama-7b \
|
47 |
+
--base_lora_model_name_or_path tloen/alpaca-lora-7b \
|
48 |
+
--tokenizer_model_name_or_path huggyllama/llama-7b \
|
49 |
+
--lora_model_name_or_path sl-alex/llama-7b-alpaca-stepwise-lora \
|
50 |
+
--use_bos_token_in_prompt \
|
51 |
+
--overrun_countermeasures False
|
52 |
+
```
|
53 |
+
|
54 |
+
## Prompt style
|
55 |
+
|
56 |
+
The model is finetuned for instruction-response.
|
57 |
+
|
58 |
+
`prompt = '<s>Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\nHow do I feed a family of 5 without ingredients?\n\n### Response:\n<|step_start|>'`
|
59 |
+
|
60 |
+
## Example output:
|
61 |
+
|
62 |
+
`$ How do I drink a matcha latte?`
|
63 |
+
`I’ve never drunk a matcha latte before, but I’ve seen people do it online. It looks like they dump the entire contents of a little teabag into a frothed milk drink and then mix it well. I think I could do that.<|step_end|><|step_start|>I’ll have to buy a matcha latte kit first, because I don’t know what they have in the teabags. I’ll see if my favorite coffee shop sells them.<|step_end|><|step_start|>I’ll also need a whisk or a mixer. I’ll look online for the best one. Which one do you recommend?<|step_end|><|step_start|>I’ll need to heat up the milk first. Which will you use -- the microwave or the stovetop?<|step_end|><|step_start|>I’ll warm up 16 ounces of milk in the microwave. For the stovetop, I’ll just put it on the burner for two minutes. I don’t want it to boil.`
|
64 |
+
|
65 |
+
`$ What is the third Fibonacci number?`
|
66 |
+
`I need to find the third Fibonacci number, which is the number after the second, which is F(2).<|step_end|><|step_start|>There are two ways to get the third Fibonacci number. I could either wait one more day and get F(3) using the Fibonacci sequence, or I could do something more clever and faster by using a computer. <|step_end|><|step_start|>Computers are great for mathematics, so I'll see if I can get F(3) quicker with a computer.<|step_end|><|step_start|>First, though, I'll explain what Fibonacci means. It's named after a 13th-century Italian accountant named Leonardo Fibonacci who created a sequence of numbers where each following number is the sum of the two previous ones. <|step_end|><|step_start|>The Fibonacci sequence begins 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on. <|step_end|><|`
|
67 |
+
|
68 |
+
`$ How do I make a cup of tea?`
|
69 |
+
`First, I find a teaspoonful of loose-leaf Assam tea in a teapot. Then, I fill the teapot with water that has been warming up over a stovetop burner.<|step_end|><|step_start|>Once the water has reached a rolling boil, I pour it over the tea, cover the pot, and steam it for at least two minutes. Uncover the pot, remove the lid, and serve. That's how to make a cup of tea.`
|
70 |
+
|
71 |
+
`<|response_start|>I've always thought Assam tea was an Indian tea, but this web site says it comes from the north-center part of Bangladesh. I wonder if there's a difference between Assam and Bangladesh tea.<|Response_End|><|step_start|>BANGLADESH tea has all the qualities of Assam, but the difference in the final cup lies in the aroma and the lingering aftertaste.`
|
72 |
+
|
73 |
+
`<|step_end|><|response_start|>The Assam tea comes in very large, flat pieces of processed leaves. They are cut from the tree and rolled`
|
74 |
+
|
75 |
+
`$ How do I open a jar?`
|
76 |
+
`I need to find a jar opener at my school. I can't just use my mouth because it's too dangerous to choke on the lid, and it would ruin my school uniform. I could bring a bottle opener from home, but it might not work. I also can't use a knife, because that could get me into trouble with the headmaster. The solution is to ask a friendly student to open the jar for me.</|step_end|><|step_start|>I find a student who is willing to help. We both hold the jar with our hands on the inside and outside of the rim, and she uses her nails to pry the lid off. She has been doing this for years, and it looks easy, but I should be careful not to scratch myself.</|step_end|><|step_start|>We set the jar down and all the pieces are there: the lid, the jar, and the plastic bag. I can never open another jar without feeling proud of myself. My classmates are impressed by my skills as a consumer.</|step_end|><|step_start|>I should keep the lid as a souvenir, but`
|
adapter_config.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"base_model_name_or_path": null,
|
3 |
+
"bias": "none",
|
4 |
+
"fan_in_fan_out": false,
|
5 |
+
"inference_mode": true,
|
6 |
+
"init_lora_weights": true,
|
7 |
+
"layers_pattern": null,
|
8 |
+
"layers_to_transform": null,
|
9 |
+
"lora_alpha": 16,
|
10 |
+
"lora_dropout": 0.0,
|
11 |
+
"modules_to_save": null,
|
12 |
+
"peft_type": "LORA",
|
13 |
+
"r": 64,
|
14 |
+
"revision": null,
|
15 |
+
"target_modules": [
|
16 |
+
"q_proj",
|
17 |
+
"down_proj",
|
18 |
+
"up_proj",
|
19 |
+
"k_proj",
|
20 |
+
"gate_proj",
|
21 |
+
"v_proj",
|
22 |
+
"o_proj"
|
23 |
+
],
|
24 |
+
"task_type": "CAUSAL_LM"
|
25 |
+
}
|
adapter_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e5ef253b04fd3562ef234c1e8483d31971184c04ccc75976b05147df002089e
|
3 |
+
size 319984845
|
added_tokens.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"[PAD]": 32000
|
3 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"eos_token": "</s>",
|
4 |
+
"pad_token": "[PAD]",
|
5 |
+
"unk_token": "<unk>"
|
6 |
+
}
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
3 |
+
size 499723
|
tokenizer_config.json
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"bos_token": {
|
5 |
+
"__type": "AddedToken",
|
6 |
+
"content": "<s>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": true,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false
|
11 |
+
},
|
12 |
+
"clean_up_tokenization_spaces": false,
|
13 |
+
"eos_token": {
|
14 |
+
"__type": "AddedToken",
|
15 |
+
"content": "</s>",
|
16 |
+
"lstrip": false,
|
17 |
+
"normalized": true,
|
18 |
+
"rstrip": false,
|
19 |
+
"single_word": false
|
20 |
+
},
|
21 |
+
"model_max_length": 2048,
|
22 |
+
"pad_token": null,
|
23 |
+
"padding_side": "right",
|
24 |
+
"sp_model_kwargs": {},
|
25 |
+
"tokenizer_class": "LlamaTokenizer",
|
26 |
+
"unk_token": {
|
27 |
+
"__type": "AddedToken",
|
28 |
+
"content": "<unk>",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": true,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false
|
33 |
+
}
|
34 |
+
}
|