Upload 7 files
Browse files- README.files/pfp.png +0 -0
- README.md +83 -1
- config.json +27 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +52 -0
README.files/pfp.png
ADDED
README.md
CHANGED
@@ -1,3 +1,85 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: cc
|
3 |
+
language:
|
4 |
+
- zh
|
5 |
+
library_name: transformers
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
widget:
|
8 |
+
- text: 问:什么是鹦鹉?
|
9 |
+
- text: 问:什么是大象?
|
10 |
+
- text: 问:谁是李白?
|
11 |
+
- text: 问:什么是黑洞?
|
12 |
+
- text: 从前有个胖鹦鹉,胖得飞不动。
|
13 |
+
- text: 从前有个小姑娘从来不洗脸。孔子说:
|
14 |
+
datasets:
|
15 |
+
- adam89/TinyStoriesChinese
|
16 |
+
- fzmnm/TinyStoriesAdv-zh
|
17 |
---
|
18 |
+
|
19 |
+
### TinyStoriesAdv_v2_92M
|
20 |
+
|
21 |
+
![alt text](README.files/pfp.png)
|
22 |
+
|
23 |
+
keywords: grade school level, large language model, small language model, tiny language model, super tiny language model, 小学生知识水平,大语言模型,小语言模型,迷你语言模型, llm, slm.
|
24 |
+
|
25 |
+
超迷你的玩具模型,只能讲中文,可以回答一些小学生的常识问题。幻觉严重。但是很有趣。
|
26 |
+
受到[TinyStories](https://arxiv.org/abs/2305.07759)、[Phi2](https://arxiv.org/abs/2309.05463)等论文的启发,使用了自己制作的全合成的数据库 https://huggingface.co/datasets/fzmnm/TinyStoriesAdv-zh
|
27 |
+
|
28 |
+
**版本v2更新:**
|
29 |
+
根据PhysicsOfLLM [3.1](https://arxiv.org/abs/2309.14316),[3.2](https://arxiv.org/pdf/2309.14402),[3.3](https://arxiv.org/abs/2404.05405),的建议,优化了百科词条部分的训练数据,使得模型能够较好地掌握小学生百科全书里的知识。也根据PhysicsOfLLM [2.1](https://arxiv.org/abs/2407.20311),[2.2](https://arxiv.org/pdf/2408.16293) 加入了一些推理能力的训练。在92M的参数下达到了之前215M版本的水平,知识的掌握也更好了。
|
30 |
+
|
31 |
+
|
32 |
+
采用了类似Qwen的Llama架构,包括了RoPE和GatedMLP。具体的超参数如下:
|
33 |
+
```python
|
34 |
+
vocab_size=6000
|
35 |
+
dim=640;n_layers=20;n_heads=10;n_kv_heads=2;max_seq_len=1024;embedding_weight_tying=True;
|
36 |
+
tokens_per_iteration=524288
|
37 |
+
dropout=0.1
|
38 |
+
warmup_iters=1000;stable_iters=9000
|
39 |
+
```
|
40 |
+
A100上10小时即可训练完毕。
|
41 |
+
这个是预训练版本,没有进行偏好微调。
|
42 |
+
|
43 |
+
#### 用法:
|
44 |
+
|
45 |
+
```python
|
46 |
+
from transformers import pipeline
|
47 |
+
|
48 |
+
generator = pipeline('text-generation', model='fzmnm/TinyStoriesAdv_92M')
|
49 |
+
story_prompt = "问:什么是鹦鹉?"
|
50 |
+
generated_story = generator(story_prompt, max_length=256, truncation=True)
|
51 |
+
|
52 |
+
print(generated_story[0]['generated_text'])
|
53 |
+
```
|
54 |
+
|
55 |
+
#### 试玩:
|
56 |
+
|
57 |
+
>问:什么是鹦鹉?
|
58 |
+
>
|
59 |
+
>答:<span style="color:blue">鹦鹉是一种非常聪明的鸟类,它们能够学会很多事情,比如如何飞翔和说话。</span>
|
60 |
+
|
61 |
+
>问:什么是大象?
|
62 |
+
>
|
63 |
+
>答:<span style="color:blue">大象是一种大型的动物,它们的身体很大,有长长的鼻子,非常灵活。</span>
|
64 |
+
|
65 |
+
>问:谁是李白?
|
66 |
+
>
|
67 |
+
>答:<span style="color:blue">李白是唐代的著名诗人,他的诗作《静夜思》也是他的代表作之一。</span>
|
68 |
+
|
69 |
+
>问:什么是黑洞?
|
70 |
+
>
|
71 |
+
>答:<span style="color:blue">黑洞是宇宙中的一种神秘天体,它们的引力非常强大,连光都无法逃脱。</span>
|
72 |
+
|
73 |
+
>问:肚子疼怎么办
|
74 |
+
>
|
75 |
+
>答:<span style="color:blue">肚子疼可能是因为吃了太多的食物,或者吃了太多不健康的食物,或者吃了太多糖果和油炸食品。</span>
|
76 |
+
|
77 |
+
>问:晚上睡不着怎么办?
|
78 |
+
>
|
79 |
+
>答:<span style="color:blue">晚上睡不着,可以试试做一些简单的睡眠,比如睡前喝一杯温水,醒来后再去睡觉。</span>
|
80 |
+
|
81 |
+
>从前有个胖鹦鹉,胖得飞不动。
|
82 |
+
>
|
83 |
+
><span style="color:blue">有一天,胖鹦鹉在森林里散步。它看到一个小女孩在哭。“怎么了?”胖鹦鹉问。“我丢了我的玩具,”小女孩说。“别担心,我会帮你找到它的。”胖鹦鹉说。小女孩和胖鹦鹉一起寻找玩具。他们找遍了树下、灌木丛后面,还在上寻找。最后,他们在一个大箱子下找到了玩具。小女孩非常高兴,感谢了胖鹦鹉。“你是个好朋友,胖鹦鹉”她说。“我会永远记住你的。”从那天起,胖鹦鹉和小女孩成为了最好的朋友,每天一起玩耍。</span>
|
84 |
+
|
85 |
+
>从前有个小姑娘从来不洗脸。孔子说:<span style="color:blue">“我每天都要洗脸,这样可以保持皮肤健康。”有一天,姑娘问孔子:“你为什么每天都洗脸?”孔子回答:“我每天都要洗脸。”姑娘问:“你为什么要洗脸?”孔子说:“我每天都要洗,我不会让你们的皮肤受苦。”姑娘生气地说:“你这样做不对,我不会帮你!”孔子只好把她关进屋子里,告诉她:“别再洗了!”姑娘生气地说:“我不会让你们的皮肤受苦!”孔子说:“你们应该听我的。你们要学会照顾自己的皮肤,不要让它受苦。”姑娘生气地说:“我不会!我不会!”</span>
|
config.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"LlamaForCausalLM"
|
4 |
+
],
|
5 |
+
"attention_bias": false,
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 1,
|
8 |
+
"eos_token_id": 2,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 640,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 1728,
|
13 |
+
"max_position_embeddings": 1024,
|
14 |
+
"mlp_bias": false,
|
15 |
+
"model_type": "llama",
|
16 |
+
"num_attention_heads": 10,
|
17 |
+
"num_hidden_layers": 20,
|
18 |
+
"num_key_value_heads": 2,
|
19 |
+
"pretraining_tp": 1,
|
20 |
+
"rms_norm_eps": 1e-05,
|
21 |
+
"rope_scaling": null,
|
22 |
+
"rope_theta": 10000.0,
|
23 |
+
"tie_word_embeddings": true,
|
24 |
+
"transformers_version": "4.42.3",
|
25 |
+
"use_cache": true,
|
26 |
+
"vocab_size": 6000
|
27 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2cf8a0d29e173005fd875f0a9995b5f058ac51923e30a641010ad7c5c0a25c5d
|
3 |
+
size 179823458
|
special_tokens_map.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": "<s>",
|
3 |
+
"eos_token": "</s>",
|
4 |
+
"mask_token": "<mask>",
|
5 |
+
"pad_token": "<pad>",
|
6 |
+
"unk_token": "<unk>"
|
7 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"0": {
|
4 |
+
"content": "<pad>",
|
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 |
+
"3": {
|
28 |
+
"content": "<unk>",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": false,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false,
|
33 |
+
"special": true
|
34 |
+
},
|
35 |
+
"4": {
|
36 |
+
"content": "<mask>",
|
37 |
+
"lstrip": false,
|
38 |
+
"normalized": false,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": true
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"bos_token": "<s>",
|
45 |
+
"clean_up_tokenization_spaces": true,
|
46 |
+
"eos_token": "</s>",
|
47 |
+
"mask_token": "<mask>",
|
48 |
+
"model_max_length": 1000000000000000019884624838656,
|
49 |
+
"pad_token": "<pad>",
|
50 |
+
"tokenizer_class": "PreTrainedTokenizerFast",
|
51 |
+
"unk_token": "<unk>"
|
52 |
+
}
|