FirstPotatoCoder commited on
Commit
6ee828b
·
verified ·
1 Parent(s): 35b6e86

Upload tokenizer

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. chat_template.jinja +45 -0
  3. tokenizer.json +3 -0
  4. tokenizer_config.json +16 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* 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
 
 
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
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ {%- for message in messages %}
3
+ {#-- Validate role is a stringified integer --#}
4
+ {%- if not message['role'] is string or not message['role'].isdigit() %}
5
+ {{- raise_exception("The role must be an integer or a stringified integer (e.g. '0') designating the speaker id") }}
6
+ {%- endif %}
7
+
8
+ {#-- Validate content is a list --#}
9
+ {%- set content = message['content'] %}
10
+ {%- if content is not iterable or content is string %}
11
+ {{- raise_exception("The content must be a list") }}
12
+ {%- endif %}
13
+
14
+ {#-- Collect content types --#}
15
+ {%- set content_types = content | map(attribute='type') | list %}
16
+ {%- set is_last = loop.last %}
17
+
18
+ {#-- Last message validation --#}
19
+ {%- if is_last %}
20
+ {%- if 'text' not in content_types %}
21
+ {{- raise_exception("The last message must include one item of type 'text'") }}
22
+ {%- elif (content_types | select('equalto', 'text') | list | length > 1) or (content_types | select('equalto', 'audio') | list | length > 1) %}
23
+ {{- raise_exception("At most two items are allowed in the last message: one 'text' and one 'audio'") }}
24
+ {%- endif %}
25
+
26
+ {#-- All other messages validation --#}
27
+ {%- else %}
28
+ {%- if content_types | select('equalto', 'text') | list | length != 1
29
+ or content_types | select('equalto', 'audio') | list | length != 1 %}
30
+ {{- raise_exception("Each message (except the last) must contain exactly one 'text' and one 'audio' item") }}
31
+ {%- elif content_types | reject('in', ['text', 'audio']) | list | length > 0 %}
32
+ {{- raise_exception("Only 'text' and 'audio' types are allowed in content") }}
33
+ {%- endif %}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+
37
+ {%- for message in messages %}
38
+ {{- bos_token }}
39
+ {{- '[' + message['role'] + ']' }}
40
+ {{- message['content'][0]['text'] }}
41
+ {{- eos_token }}
42
+ {%- if message['content']|length > 1 %}
43
+ {{- '<|AUDIO|><|audio_eos|>' }}
44
+ {%- endif %}
45
+ {%- endfor %}
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80f511469b4aceda8c17ccafef2310eceeda9dd4589cf2c062bd0279eef5646d
3
+ size 17209980
tokenizer_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<|begin_of_text|>",
4
+ "clean_up_tokenization_spaces": true,
5
+ "eos_token": "<|end_of_text|>",
6
+ "is_local": false,
7
+ "model_input_names": [
8
+ "input_ids",
9
+ "attention_mask"
10
+ ],
11
+ "model_max_length": 131072,
12
+ "model_specific_special_tokens": {},
13
+ "pad_token": "<|end_of_text|>",
14
+ "processor_class": "CsmProcessor",
15
+ "tokenizer_class": "TokenizersBackend"
16
+ }