Upload folder using huggingface_hub
Browse files- README.md +9 -12
- model.bin +2 -2
- special_tokens_map.json +3 -21
- tokenizer.json +20 -2
- tokenizer_config.json +53 -23
- vocabulary.json +3 -1
README.md
CHANGED
@@ -3,7 +3,7 @@ license: apache-2.0
|
|
3 |
datasets:
|
4 |
- cerebras/SlimPajama-627B
|
5 |
- bigcode/starcoderdata
|
6 |
-
-
|
7 |
language:
|
8 |
- en
|
9 |
---
|
@@ -16,23 +16,20 @@ https://github.com/jzhang38/TinyLlama
|
|
16 |
|
17 |
The TinyLlama project aims to **pretrain** a **1.1B Llama model on 3 trillion tokens**. With some proper optimization, we can achieve this within a span of "just" 90 days using 16 A100-40G GPUs 🚀🚀. The training has started on 2023-09-01.
|
18 |
|
19 |
-
<div align="center">
|
20 |
-
<img src="./TinyLlama_logo.png" width="300"/>
|
21 |
-
</div>
|
22 |
|
23 |
We adopted exactly the same architecture and tokenizer as Llama 2. This means TinyLlama can be plugged and played in many open-source projects built upon Llama. Besides, TinyLlama is compact with only 1.1B parameters. This compactness allows it to cater to a multitude of applications demanding a restricted computation and memory footprint.
|
24 |
|
25 |
#### This Model
|
26 |
-
This is the chat model finetuned on [PY007/TinyLlama-1.1B-intermediate-step-
|
27 |
-
|
28 |
#### How to use
|
29 |
You will need the transformers>=4.31
|
30 |
Do check the [TinyLlama](https://github.com/jzhang38/TinyLlama) github page for more information.
|
31 |
-
```
|
32 |
from transformers import AutoTokenizer
|
33 |
import transformers
|
34 |
import torch
|
35 |
-
model = "PY007/TinyLlama-1.1B-Chat-v0.
|
36 |
tokenizer = AutoTokenizer.from_pretrained(model)
|
37 |
pipeline = transformers.pipeline(
|
38 |
"text-generation",
|
@@ -41,9 +38,9 @@ pipeline = transformers.pipeline(
|
|
41 |
device_map="auto",
|
42 |
)
|
43 |
|
44 |
-
prompt = "
|
45 |
formatted_prompt = (
|
46 |
-
f"
|
47 |
)
|
48 |
|
49 |
|
@@ -51,10 +48,10 @@ sequences = pipeline(
|
|
51 |
formatted_prompt,
|
52 |
do_sample=True,
|
53 |
top_k=50,
|
54 |
-
top_p = 0.
|
55 |
num_return_sequences=1,
|
56 |
repetition_penalty=1.1,
|
57 |
-
max_new_tokens=
|
58 |
)
|
59 |
for seq in sequences:
|
60 |
print(f"Result: {seq['generated_text']}")
|
|
|
3 |
datasets:
|
4 |
- cerebras/SlimPajama-627B
|
5 |
- bigcode/starcoderdata
|
6 |
+
- OpenAssistant/oasst_top1_2023-08-25
|
7 |
language:
|
8 |
- en
|
9 |
---
|
|
|
16 |
|
17 |
The TinyLlama project aims to **pretrain** a **1.1B Llama model on 3 trillion tokens**. With some proper optimization, we can achieve this within a span of "just" 90 days using 16 A100-40G GPUs 🚀🚀. The training has started on 2023-09-01.
|
18 |
|
|
|
|
|
|
|
19 |
|
20 |
We adopted exactly the same architecture and tokenizer as Llama 2. This means TinyLlama can be plugged and played in many open-source projects built upon Llama. Besides, TinyLlama is compact with only 1.1B parameters. This compactness allows it to cater to a multitude of applications demanding a restricted computation and memory footprint.
|
21 |
|
22 |
#### This Model
|
23 |
+
This is the chat model finetuned on top of [PY007/TinyLlama-1.1B-intermediate-step-480k-1T](https://huggingface.co/PY007/TinyLlama-1.1B-intermediate-step-480k-1T).
|
24 |
+
The dataset used is [OpenAssistant/oasst_top1_2023-08-25](https://huggingface.co/datasets/OpenAssistant/oasst_top1_2023-08-25) following the [chatml](https://github.com/openai/openai-python/blob/main/chatml.md) format.
|
25 |
#### How to use
|
26 |
You will need the transformers>=4.31
|
27 |
Do check the [TinyLlama](https://github.com/jzhang38/TinyLlama) github page for more information.
|
28 |
+
```
|
29 |
from transformers import AutoTokenizer
|
30 |
import transformers
|
31 |
import torch
|
32 |
+
model = "PY007/TinyLlama-1.1B-Chat-v0.3"
|
33 |
tokenizer = AutoTokenizer.from_pretrained(model)
|
34 |
pipeline = transformers.pipeline(
|
35 |
"text-generation",
|
|
|
38 |
device_map="auto",
|
39 |
)
|
40 |
|
41 |
+
prompt = "How to get in a good university?"
|
42 |
formatted_prompt = (
|
43 |
+
f"<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
|
44 |
)
|
45 |
|
46 |
|
|
|
48 |
formatted_prompt,
|
49 |
do_sample=True,
|
50 |
top_k=50,
|
51 |
+
top_p = 0.9,
|
52 |
num_return_sequences=1,
|
53 |
repetition_penalty=1.1,
|
54 |
+
max_new_tokens=1024,
|
55 |
)
|
56 |
for seq in sequences:
|
57 |
print(f"Result: {seq['generated_text']}")
|
model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:89eef765f34bef31eab7e1ec4a1c9209d75d702e322eb29ae1926b477eb1b821
|
3 |
+
size 1102191099
|
special_tokens_map.json
CHANGED
@@ -1,24 +1,6 @@
|
|
1 |
{
|
2 |
-
"bos_token":
|
3 |
-
|
4 |
-
"lstrip": false,
|
5 |
-
"normalized": false,
|
6 |
-
"rstrip": false,
|
7 |
-
"single_word": false
|
8 |
-
},
|
9 |
-
"eos_token": {
|
10 |
-
"content": "</s>",
|
11 |
-
"lstrip": false,
|
12 |
-
"normalized": false,
|
13 |
-
"rstrip": false,
|
14 |
-
"single_word": false
|
15 |
-
},
|
16 |
"pad_token": "[PAD]",
|
17 |
-
"unk_token":
|
18 |
-
"content": "<unk>",
|
19 |
-
"lstrip": false,
|
20 |
-
"normalized": false,
|
21 |
-
"rstrip": false,
|
22 |
-
"single_word": false
|
23 |
-
}
|
24 |
}
|
|
|
1 |
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"eos_token": "</s>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
"pad_token": "[PAD]",
|
5 |
+
"unk_token": "<unk>"
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
}
|
tokenizer.json
CHANGED
@@ -34,10 +34,28 @@
|
|
34 |
"id": 32000,
|
35 |
"content": "[PAD]",
|
36 |
"single_word": false,
|
37 |
-
"lstrip":
|
38 |
-
"rstrip":
|
39 |
"normalized": false,
|
40 |
"special": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
],
|
43 |
"normalizer": {
|
|
|
34 |
"id": 32000,
|
35 |
"content": "[PAD]",
|
36 |
"single_word": false,
|
37 |
+
"lstrip": true,
|
38 |
+
"rstrip": true,
|
39 |
"normalized": false,
|
40 |
"special": true
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"id": 32001,
|
44 |
+
"content": "<|im_start|>",
|
45 |
+
"single_word": false,
|
46 |
+
"lstrip": false,
|
47 |
+
"rstrip": false,
|
48 |
+
"normalized": true,
|
49 |
+
"special": false
|
50 |
+
},
|
51 |
+
{
|
52 |
+
"id": 32002,
|
53 |
+
"content": "<|im_end|>",
|
54 |
+
"single_word": false,
|
55 |
+
"lstrip": false,
|
56 |
+
"rstrip": false,
|
57 |
+
"normalized": true,
|
58 |
+
"special": false
|
59 |
}
|
60 |
],
|
61 |
"normalizer": {
|
tokenizer_config.json
CHANGED
@@ -1,34 +1,64 @@
|
|
1 |
{
|
2 |
-
"
|
3 |
-
"
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
},
|
|
|
|
|
10 |
"clean_up_tokenization_spaces": false,
|
11 |
-
"eos_token":
|
12 |
-
"__type": "AddedToken",
|
13 |
-
"content": "</s>",
|
14 |
-
"lstrip": false,
|
15 |
-
"normalized": false,
|
16 |
-
"rstrip": false,
|
17 |
-
"single_word": false
|
18 |
-
},
|
19 |
"legacy": false,
|
20 |
"model_max_length": 1000000000000000019884624838656,
|
21 |
"pad_token": null,
|
22 |
"padding_side": "right",
|
23 |
"sp_model_kwargs": {},
|
24 |
"tokenizer_class": "LlamaTokenizer",
|
25 |
-
"unk_token":
|
26 |
-
"__type": "AddedToken",
|
27 |
-
"content": "<unk>",
|
28 |
-
"lstrip": false,
|
29 |
-
"normalized": false,
|
30 |
-
"rstrip": false,
|
31 |
-
"single_word": false
|
32 |
-
},
|
33 |
"use_default_system_prompt": true
|
34 |
}
|
|
|
1 |
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"0": {
|
4 |
+
"content": "<unk>",
|
5 |
+
"lstrip": false,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": false,
|
8 |
+
"single_word": false,
|
9 |
+
"special": true
|
10 |
+
},
|
11 |
+
"1": {
|
12 |
+
"content": "<s>",
|
13 |
+
"lstrip": false,
|
14 |
+
"normalized": false,
|
15 |
+
"rstrip": false,
|
16 |
+
"single_word": false,
|
17 |
+
"special": true
|
18 |
+
},
|
19 |
+
"2": {
|
20 |
+
"content": "</s>",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false,
|
25 |
+
"special": true
|
26 |
+
},
|
27 |
+
"32000": {
|
28 |
+
"content": "[PAD]",
|
29 |
+
"lstrip": true,
|
30 |
+
"normalized": false,
|
31 |
+
"rstrip": true,
|
32 |
+
"single_word": false,
|
33 |
+
"special": true
|
34 |
+
},
|
35 |
+
"32001": {
|
36 |
+
"content": "<|im_start|>",
|
37 |
+
"lstrip": false,
|
38 |
+
"normalized": true,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": false
|
42 |
+
},
|
43 |
+
"32002": {
|
44 |
+
"content": "<|im_end|>",
|
45 |
+
"lstrip": false,
|
46 |
+
"normalized": true,
|
47 |
+
"rstrip": false,
|
48 |
+
"single_word": false,
|
49 |
+
"special": false
|
50 |
+
}
|
51 |
},
|
52 |
+
"additional_special_tokens": [],
|
53 |
+
"bos_token": "<s>",
|
54 |
"clean_up_tokenization_spaces": false,
|
55 |
+
"eos_token": "</s>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
"legacy": false,
|
57 |
"model_max_length": 1000000000000000019884624838656,
|
58 |
"pad_token": null,
|
59 |
"padding_side": "right",
|
60 |
"sp_model_kwargs": {},
|
61 |
"tokenizer_class": "LlamaTokenizer",
|
62 |
+
"unk_token": "<unk>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
"use_default_system_prompt": true
|
64 |
}
|
vocabulary.json
CHANGED
@@ -31999,5 +31999,7 @@
|
|
31999 |
"\u6536",
|
32000 |
"\u5f18",
|
32001 |
"\u7ed9",
|
32002 |
-
"[PAD]"
|
|
|
|
|
32003 |
]
|
|
|
31999 |
"\u6536",
|
32000 |
"\u5f18",
|
32001 |
"\u7ed9",
|
32002 |
+
"[PAD]",
|
32003 |
+
"<|im_start|>",
|
32004 |
+
"<|im_end|>"
|
32005 |
]
|