Upload folder using huggingface_hub
Browse files- README.md +11 -2
- chat_template.jinja +1 -5
- tokenization_kimi.py +2 -1
README.md
CHANGED
|
@@ -8,7 +8,7 @@ This tiny model is intended for debugging. It is randomly initialized using the
|
|
| 8 |
|
| 9 |
| File path | Size |
|
| 10 |
|------|------|
|
| 11 |
-
| model.safetensors | 6.
|
| 12 |
|
| 13 |
|
| 14 |
### Example usage:
|
|
@@ -67,6 +67,9 @@ print(output_text)
|
|
| 67 |
|
| 68 |
### Codes to create this repo:
|
| 69 |
|
|
|
|
|
|
|
|
|
|
| 70 |
```python
|
| 71 |
import json
|
| 72 |
from pathlib import Path
|
|
@@ -174,8 +177,12 @@ replace_file(f'{save_folder}/modeling_kimi_k25.py',
|
|
| 174 |
"")
|
| 175 |
```
|
| 176 |
|
|
|
|
|
|
|
| 177 |
### Printing the model:
|
| 178 |
|
|
|
|
|
|
|
| 179 |
```text
|
| 180 |
KimiK25ForConditionalGeneration(
|
| 181 |
(vision_tower): MoonViT3dPretrainedModel(
|
|
@@ -270,4 +277,6 @@ KimiK25ForConditionalGeneration(
|
|
| 270 |
(lm_head): Linear(in_features=8, out_features=163840, bias=False)
|
| 271 |
)
|
| 272 |
)
|
| 273 |
-
```
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
| File path | Size |
|
| 10 |
|------|------|
|
| 11 |
+
| model.safetensors | 6.2MB |
|
| 12 |
|
| 13 |
|
| 14 |
### Example usage:
|
|
|
|
| 67 |
|
| 68 |
### Codes to create this repo:
|
| 69 |
|
| 70 |
+
<details>
|
| 71 |
+
<summary>Python codes</summary>
|
| 72 |
+
|
| 73 |
```python
|
| 74 |
import json
|
| 75 |
from pathlib import Path
|
|
|
|
| 177 |
"")
|
| 178 |
```
|
| 179 |
|
| 180 |
+
</details>
|
| 181 |
+
|
| 182 |
### Printing the model:
|
| 183 |
|
| 184 |
+
<details><summary>Click to expand</summary>
|
| 185 |
+
|
| 186 |
```text
|
| 187 |
KimiK25ForConditionalGeneration(
|
| 188 |
(vision_tower): MoonViT3dPretrainedModel(
|
|
|
|
| 277 |
(lm_head): Linear(in_features=8, out_features=163840, bias=False)
|
| 278 |
)
|
| 279 |
)
|
| 280 |
+
```
|
| 281 |
+
|
| 282 |
+
</details>
|
chat_template.jinja
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
{%- elif c is not none -%}
|
| 6 |
{% for content in c -%}
|
| 7 |
{% if content['type'] == 'image' or content['type'] == 'image_url' -%}
|
| 8 |
-
<|
|
| 9 |
{% elif content['type'] == 'video' or content['type']== 'video_url'-%}
|
| 10 |
<|kimi_k25_video_placeholder|>
|
| 11 |
{% else -%}
|
|
@@ -57,10 +57,6 @@
|
|
| 57 |
<|im_system|>tool_declare<|im_middle|>{{ tools | tojson(separators=(',', ':')) }}<|im_end|>
|
| 58 |
{%- endif -%}
|
| 59 |
{%- endif -%}
|
| 60 |
-
|
| 61 |
-
{%- if messages|length == 0 or messages[0]['role'] != 'system' -%}
|
| 62 |
-
<|im_system|>system<|im_middle|>You are Kimi, an AI assistant created by Moonshot AI.<|im_end|>
|
| 63 |
-
{%- endif -%}
|
| 64 |
|
| 65 |
{%- for message in hist_msgs -%}
|
| 66 |
{{set_roles(message)}}
|
|
|
|
| 5 |
{%- elif c is not none -%}
|
| 6 |
{% for content in c -%}
|
| 7 |
{% if content['type'] == 'image' or content['type'] == 'image_url' -%}
|
| 8 |
+
<|media_begin|>image<|media_content|><|media_pad|><|media_end|>
|
| 9 |
{% elif content['type'] == 'video' or content['type']== 'video_url'-%}
|
| 10 |
<|kimi_k25_video_placeholder|>
|
| 11 |
{% else -%}
|
|
|
|
| 57 |
<|im_system|>tool_declare<|im_middle|>{{ tools | tojson(separators=(',', ':')) }}<|im_end|>
|
| 58 |
{%- endif -%}
|
| 59 |
{%- endif -%}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
{%- for message in hist_msgs -%}
|
| 62 |
{{set_roles(message)}}
|
tokenization_kimi.py
CHANGED
|
@@ -8,7 +8,8 @@ from typing import Any, Dict, Iterator, List, Optional, Tuple, Union, cast
|
|
| 8 |
import tiktoken
|
| 9 |
from tiktoken.load import load_tiktoken_bpe
|
| 10 |
from tokenizers import AddedToken
|
| 11 |
-
|
|
|
|
| 12 |
from transformers.tokenization_utils import PreTrainedTokenizer
|
| 13 |
|
| 14 |
from .tool_declaration_ts import encode_tools_to_typescript_style
|
|
|
|
| 8 |
import tiktoken
|
| 9 |
from tiktoken.load import load_tiktoken_bpe
|
| 10 |
from tokenizers import AddedToken
|
| 11 |
+
|
| 12 |
+
from transformers.convert_slow_tokenizer import bytes_to_unicode
|
| 13 |
from transformers.tokenization_utils import PreTrainedTokenizer
|
| 14 |
|
| 15 |
from .tool_declaration_ts import encode_tools_to_typescript_style
|