Upload folder using huggingface_hub
Browse files- chat_template.jinja +45 -0
- config.json +2 -2
- generation_config.json +6 -2
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 %}
|
config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"architectures": [
|
| 3 |
-
"
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
|
@@ -114,7 +114,7 @@
|
|
| 114 |
"tie_codebooks_embeddings": true,
|
| 115 |
"tie_word_embeddings": false,
|
| 116 |
"torch_dtype": "float32",
|
| 117 |
-
"transformers_version": "4.
|
| 118 |
"use_cache": true,
|
| 119 |
"vocab_size": 2051
|
| 120 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"architectures": [
|
| 3 |
+
"CsmForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
|
|
|
| 114 |
"tie_codebooks_embeddings": true,
|
| 115 |
"tie_word_embeddings": false,
|
| 116 |
"torch_dtype": "float32",
|
| 117 |
+
"transformers_version": "4.52.0.dev0",
|
| 118 |
"use_cache": true,
|
| 119 |
"vocab_size": 2051
|
| 120 |
}
|
generation_config.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
| 1 |
{
|
| 2 |
-
"_from_model_config": true,
|
| 3 |
"bos_token_id": 128000,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
"pad_token_id": 128002,
|
| 5 |
-
"
|
|
|
|
| 6 |
}
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"bos_token_id": 128000,
|
| 3 |
+
"depth_decoder_do_sample": true,
|
| 4 |
+
"depth_decoder_temperature": 0.9,
|
| 5 |
+
"depth_decoder_top_k": 50,
|
| 6 |
+
"do_sample": true,
|
| 7 |
"pad_token_id": 128002,
|
| 8 |
+
"temperature": 0.9,
|
| 9 |
+
"transformers_version": "4.52.0.dev0"
|
| 10 |
}
|