Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- added_tokens.json +30 -0
- chat_template.jinja +89 -0
- config.json +90 -0
- configuration_qwen3_ts.py +225 -0
- generation_config.json +13 -0
- merges.txt +0 -0
- modeling_qwen3_ts.py +622 -0
- processing_qwen3_ts.py +224 -0
- processor_config.json +6 -0
- pytorch_model-00001-of-00004.bin +3 -0
- pytorch_model-00002-of-00004.bin +3 -0
- pytorch_model-00003-of-00004.bin +3 -0
- pytorch_model-00004-of-00004.bin +3 -0
- pytorch_model.bin.index.json +417 -0
- special_tokens_map.json +20 -0
- tokenizer.json +3 -0
- tokenizer_config.json +249 -0
- trainer_state.json +0 -0
- training_args.bin +3 -0
- vocab.json +0 -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
|
added_tokens.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</think>": 151668,
|
| 3 |
+
"</tool_call>": 151658,
|
| 4 |
+
"</tool_response>": 151666,
|
| 5 |
+
"<think>": 151667,
|
| 6 |
+
"<tool_call>": 151657,
|
| 7 |
+
"<tool_response>": 151665,
|
| 8 |
+
"<ts/>": 151670,
|
| 9 |
+
"<ts>": 151669,
|
| 10 |
+
"<|box_end|>": 151649,
|
| 11 |
+
"<|box_start|>": 151648,
|
| 12 |
+
"<|endoftext|>": 151643,
|
| 13 |
+
"<|file_sep|>": 151664,
|
| 14 |
+
"<|fim_middle|>": 151660,
|
| 15 |
+
"<|fim_pad|>": 151662,
|
| 16 |
+
"<|fim_prefix|>": 151659,
|
| 17 |
+
"<|fim_suffix|>": 151661,
|
| 18 |
+
"<|im_end|>": 151645,
|
| 19 |
+
"<|im_start|>": 151644,
|
| 20 |
+
"<|image_pad|>": 151655,
|
| 21 |
+
"<|object_ref_end|>": 151647,
|
| 22 |
+
"<|object_ref_start|>": 151646,
|
| 23 |
+
"<|quad_end|>": 151651,
|
| 24 |
+
"<|quad_start|>": 151650,
|
| 25 |
+
"<|repo_name|>": 151663,
|
| 26 |
+
"<|video_pad|>": 151656,
|
| 27 |
+
"<|vision_end|>": 151653,
|
| 28 |
+
"<|vision_pad|>": 151654,
|
| 29 |
+
"<|vision_start|>": 151652
|
| 30 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0].role == 'system' %}
|
| 4 |
+
{{- messages[0].content + '\n\n' }}
|
| 5 |
+
{%- endif %}
|
| 6 |
+
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 7 |
+
{%- for tool in tools %}
|
| 8 |
+
{{- "\n" }}
|
| 9 |
+
{{- tool | tojson }}
|
| 10 |
+
{%- endfor %}
|
| 11 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 12 |
+
{%- else %}
|
| 13 |
+
{%- if messages[0].role == 'system' %}
|
| 14 |
+
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
| 15 |
+
{%- endif %}
|
| 16 |
+
{%- endif %}
|
| 17 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 18 |
+
{%- for message in messages[::-1] %}
|
| 19 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 20 |
+
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
| 21 |
+
{%- set ns.multi_step_tool = false %}
|
| 22 |
+
{%- set ns.last_query_index = index %}
|
| 23 |
+
{%- endif %}
|
| 24 |
+
{%- endfor %}
|
| 25 |
+
{%- for message in messages %}
|
| 26 |
+
{%- if message.content is string %}
|
| 27 |
+
{%- set content = message.content %}
|
| 28 |
+
{%- else %}
|
| 29 |
+
{%- set content = '' %}
|
| 30 |
+
{%- endif %}
|
| 31 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 32 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 33 |
+
{%- elif message.role == "assistant" %}
|
| 34 |
+
{%- set reasoning_content = '' %}
|
| 35 |
+
{%- if message.reasoning_content is string %}
|
| 36 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 37 |
+
{%- else %}
|
| 38 |
+
{%- if '</think>' in content %}
|
| 39 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 40 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 41 |
+
{%- endif %}
|
| 42 |
+
{%- endif %}
|
| 43 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 44 |
+
{%- if loop.last or (not loop.last and reasoning_content) %}
|
| 45 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 46 |
+
{%- else %}
|
| 47 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 48 |
+
{%- endif %}
|
| 49 |
+
{%- else %}
|
| 50 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 51 |
+
{%- endif %}
|
| 52 |
+
{%- if message.tool_calls %}
|
| 53 |
+
{%- for tool_call in message.tool_calls %}
|
| 54 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 55 |
+
{{- '\n' }}
|
| 56 |
+
{%- endif %}
|
| 57 |
+
{%- if tool_call.function %}
|
| 58 |
+
{%- set tool_call = tool_call.function %}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{{- '<tool_call>\n{"name": "' }}
|
| 61 |
+
{{- tool_call.name }}
|
| 62 |
+
{{- '", "arguments": ' }}
|
| 63 |
+
{%- if tool_call.arguments is string %}
|
| 64 |
+
{{- tool_call.arguments }}
|
| 65 |
+
{%- else %}
|
| 66 |
+
{{- tool_call.arguments | tojson }}
|
| 67 |
+
{%- endif %}
|
| 68 |
+
{{- '}\n</tool_call>' }}
|
| 69 |
+
{%- endfor %}
|
| 70 |
+
{%- endif %}
|
| 71 |
+
{{- '<|im_end|>\n' }}
|
| 72 |
+
{%- elif message.role == "tool" %}
|
| 73 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 74 |
+
{{- '<|im_start|>user' }}
|
| 75 |
+
{%- endif %}
|
| 76 |
+
{{- '\n<tool_response>\n' }}
|
| 77 |
+
{{- content }}
|
| 78 |
+
{{- '\n</tool_response>' }}
|
| 79 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 80 |
+
{{- '<|im_end|>\n' }}
|
| 81 |
+
{%- endif %}
|
| 82 |
+
{%- endif %}
|
| 83 |
+
{%- endfor %}
|
| 84 |
+
{%- if add_generation_prompt %}
|
| 85 |
+
{{- '<|im_start|>assistant\n' }}
|
| 86 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 87 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 88 |
+
{%- endif %}
|
| 89 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3TSForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"auto_map": {
|
| 8 |
+
"AutoConfig": "configuration_qwen3_ts.Qwen3TSConfig",
|
| 9 |
+
"AutoModel": "modeling_qwen3_ts.Qwen3TSForCausalLM",
|
| 10 |
+
"AutoModelForCausalLM": "modeling_qwen3_ts.Qwen3TSForCausalLM",
|
| 11 |
+
"AutoProcessor": "processing_qwen3_ts.Qwen3TSProcessor"
|
| 12 |
+
},
|
| 13 |
+
"bos_token_id": 151643,
|
| 14 |
+
"eos_token_id": 151645,
|
| 15 |
+
"head_dim": 128,
|
| 16 |
+
"hidden_act": "silu",
|
| 17 |
+
"hidden_size": 4096,
|
| 18 |
+
"ignore_index": -100,
|
| 19 |
+
"initializer_range": 0.02,
|
| 20 |
+
"intermediate_size": 12288,
|
| 21 |
+
"layer_types": [
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"full_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"full_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"full_attention",
|
| 50 |
+
"full_attention",
|
| 51 |
+
"full_attention",
|
| 52 |
+
"full_attention",
|
| 53 |
+
"full_attention",
|
| 54 |
+
"full_attention",
|
| 55 |
+
"full_attention",
|
| 56 |
+
"full_attention",
|
| 57 |
+
"full_attention"
|
| 58 |
+
],
|
| 59 |
+
"max_position_embeddings": 40960,
|
| 60 |
+
"max_window_layers": 36,
|
| 61 |
+
"model_type": "qwen3ts",
|
| 62 |
+
"num_attention_heads": 32,
|
| 63 |
+
"num_hidden_layers": 36,
|
| 64 |
+
"num_key_value_heads": 8,
|
| 65 |
+
"pad_token_id": 151643,
|
| 66 |
+
"rms_norm_eps": 1e-06,
|
| 67 |
+
"rope_scaling": null,
|
| 68 |
+
"rope_theta": 1000000,
|
| 69 |
+
"sliding_window": null,
|
| 70 |
+
"tie_word_embeddings": false,
|
| 71 |
+
"torch_dtype": "float16",
|
| 72 |
+
"transformers_version": "4.52.4",
|
| 73 |
+
"ts": {
|
| 74 |
+
"embedding_dim": 16,
|
| 75 |
+
"hidden_size": 4096,
|
| 76 |
+
"max_length": 32768,
|
| 77 |
+
"max_sequence_length": 8192,
|
| 78 |
+
"num_features": 2,
|
| 79 |
+
"num_layers": 5,
|
| 80 |
+
"patch_size": 8,
|
| 81 |
+
"use_layer_norm": false,
|
| 82 |
+
"use_position_embedding": true,
|
| 83 |
+
"use_position_idx": false
|
| 84 |
+
},
|
| 85 |
+
"ts_token_end_index": 151670,
|
| 86 |
+
"ts_token_start_index": 151669,
|
| 87 |
+
"use_cache": false,
|
| 88 |
+
"use_sliding_window": false,
|
| 89 |
+
"vocab_size": 151936
|
| 90 |
+
}
|
configuration_qwen3_ts.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2024 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""Qwen3 model configuration"""
|
| 16 |
+
|
| 17 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 18 |
+
from transformers.modeling_rope_utils import rope_config_validation
|
| 19 |
+
from transformers.utils import logging
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
logger = logging.get_logger(__name__)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class Qwen3TSConfig(PretrainedConfig):
|
| 26 |
+
r"""
|
| 27 |
+
This is the configuration class to store the configuration of a [`Qwen3Model`]. It is used to instantiate a
|
| 28 |
+
Qwen3 model according to the specified arguments, defining the model architecture. Instantiating a configuration
|
| 29 |
+
with the defaults will yield a similar configuration to that of
|
| 30 |
+
Qwen3-8B [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B).
|
| 31 |
+
|
| 32 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 33 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
Args:
|
| 37 |
+
vocab_size (`int`, *optional*, defaults to 151936):
|
| 38 |
+
Vocabulary size of the Qwen3 model. Defines the number of different tokens that can be represented by the
|
| 39 |
+
`inputs_ids` passed when calling [`Qwen3Model`]
|
| 40 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
| 41 |
+
Dimension of the hidden representations.
|
| 42 |
+
intermediate_size (`int`, *optional*, defaults to 22016):
|
| 43 |
+
Dimension of the MLP representations.
|
| 44 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
| 45 |
+
Number of hidden layers in the Transformer encoder.
|
| 46 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
| 47 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
| 48 |
+
num_key_value_heads (`int`, *optional*, defaults to 32):
|
| 49 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
| 50 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
| 51 |
+
`num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
| 52 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
| 53 |
+
by meanpooling all the original heads within that group. For more details, check out [this
|
| 54 |
+
paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to `32`.
|
| 55 |
+
head_dim (`int`, *optional*, defaults to 128):
|
| 56 |
+
The attention head dimension.
|
| 57 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
| 58 |
+
The non-linear activation function (function or string) in the decoder.
|
| 59 |
+
max_position_embeddings (`int`, *optional*, defaults to 32768):
|
| 60 |
+
The maximum sequence length that this model might ever be used with.
|
| 61 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 62 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 63 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
| 64 |
+
The epsilon used by the rms normalization layers.
|
| 65 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
| 66 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
| 67 |
+
relevant if `config.is_decoder=True`.
|
| 68 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
| 69 |
+
Whether the model's input and output word embeddings should be tied.
|
| 70 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
| 71 |
+
The base period of the RoPE embeddings.
|
| 72 |
+
rope_scaling (`Dict`, *optional*):
|
| 73 |
+
Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
|
| 74 |
+
and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
|
| 75 |
+
accordingly.
|
| 76 |
+
Expected contents:
|
| 77 |
+
`rope_type` (`str`):
|
| 78 |
+
The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
|
| 79 |
+
'llama3'], with 'default' being the original RoPE implementation.
|
| 80 |
+
`factor` (`float`, *optional*):
|
| 81 |
+
Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
|
| 82 |
+
most scaling types, a `factor` of x will enable the model to handle sequences of length x *
|
| 83 |
+
original maximum pre-trained length.
|
| 84 |
+
`original_max_position_embeddings` (`int`, *optional*):
|
| 85 |
+
Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
|
| 86 |
+
pretraining.
|
| 87 |
+
`attention_factor` (`float`, *optional*):
|
| 88 |
+
Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
|
| 89 |
+
computation. If unspecified, it defaults to value recommended by the implementation, using the
|
| 90 |
+
`factor` field to infer the suggested value.
|
| 91 |
+
`beta_fast` (`float`, *optional*):
|
| 92 |
+
Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
|
| 93 |
+
ramp function. If unspecified, it defaults to 32.
|
| 94 |
+
`beta_slow` (`float`, *optional*):
|
| 95 |
+
Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
|
| 96 |
+
ramp function. If unspecified, it defaults to 1.
|
| 97 |
+
`short_factor` (`list[float]`, *optional*):
|
| 98 |
+
Only used with 'longrope'. The scaling factor to be applied to short contexts (<
|
| 99 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
| 100 |
+
size divided by the number of attention heads divided by 2
|
| 101 |
+
`long_factor` (`list[float]`, *optional*):
|
| 102 |
+
Only used with 'longrope'. The scaling factor to be applied to long contexts (<
|
| 103 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
| 104 |
+
size divided by the number of attention heads divided by 2
|
| 105 |
+
`low_freq_factor` (`float`, *optional*):
|
| 106 |
+
Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
|
| 107 |
+
`high_freq_factor` (`float`, *optional*):
|
| 108 |
+
Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
|
| 109 |
+
attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
|
| 110 |
+
Whether to use a bias in the query, key, value and output projection layers during self-attention.
|
| 111 |
+
use_sliding_window (`bool`, *optional*, defaults to `False`):
|
| 112 |
+
Whether to use sliding window attention.
|
| 113 |
+
sliding_window (`int`, *optional*, defaults to 4096):
|
| 114 |
+
Sliding window attention (SWA) window size. If not specified, will default to `4096`.
|
| 115 |
+
max_window_layers (`int`, *optional*, defaults to 28):
|
| 116 |
+
The number of layers using full attention. The first `max_window_layers` layers will use full attention, while any
|
| 117 |
+
additional layer afterwards will use SWA (Sliding Window Attention).
|
| 118 |
+
layer_types (`list`, *optional*):
|
| 119 |
+
Attention pattern for each layer.
|
| 120 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
| 121 |
+
The dropout ratio for the attention probabilities.
|
| 122 |
+
|
| 123 |
+
```python
|
| 124 |
+
>>> from transformers import Qwen3Model, Qwen3Config
|
| 125 |
+
|
| 126 |
+
>>> # Initializing a Qwen3 style configuration
|
| 127 |
+
>>> configuration = Qwen3Config()
|
| 128 |
+
|
| 129 |
+
>>> # Initializing a model from the Qwen3-8B style configuration
|
| 130 |
+
>>> model = Qwen3Model(configuration)
|
| 131 |
+
|
| 132 |
+
>>> # Accessing the model configuration
|
| 133 |
+
>>> configuration = model.config
|
| 134 |
+
```"""
|
| 135 |
+
|
| 136 |
+
model_type = "qwen3ts"
|
| 137 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 138 |
+
|
| 139 |
+
# Default tensor parallel plan for base model `Qwen3`
|
| 140 |
+
base_model_tp_plan = {
|
| 141 |
+
"layers.*.self_attn.q_proj": "colwise",
|
| 142 |
+
"layers.*.self_attn.k_proj": "colwise",
|
| 143 |
+
"layers.*.self_attn.v_proj": "colwise",
|
| 144 |
+
"layers.*.self_attn.o_proj": "rowwise",
|
| 145 |
+
"layers.*.mlp.gate_proj": "colwise",
|
| 146 |
+
"layers.*.mlp.up_proj": "colwise",
|
| 147 |
+
"layers.*.mlp.down_proj": "rowwise",
|
| 148 |
+
}
|
| 149 |
+
base_model_pp_plan = {
|
| 150 |
+
"embed_tokens": (["input_ids"], ["inputs_embeds"]),
|
| 151 |
+
"layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
|
| 152 |
+
"norm": (["hidden_states"], ["hidden_states"]),
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
def __init__(
|
| 156 |
+
self,
|
| 157 |
+
vocab_size=151936,
|
| 158 |
+
hidden_size=4096,
|
| 159 |
+
intermediate_size=22016,
|
| 160 |
+
num_hidden_layers=32,
|
| 161 |
+
num_attention_heads=32,
|
| 162 |
+
num_key_value_heads=32,
|
| 163 |
+
head_dim=128,
|
| 164 |
+
hidden_act="silu",
|
| 165 |
+
max_position_embeddings=32768,
|
| 166 |
+
initializer_range=0.02,
|
| 167 |
+
rms_norm_eps=1e-6,
|
| 168 |
+
use_cache=True,
|
| 169 |
+
tie_word_embeddings=False,
|
| 170 |
+
rope_theta=10000.0,
|
| 171 |
+
rope_scaling=None,
|
| 172 |
+
attention_bias=False,
|
| 173 |
+
use_sliding_window=False,
|
| 174 |
+
sliding_window=4096,
|
| 175 |
+
max_window_layers=28,
|
| 176 |
+
layer_types=None,
|
| 177 |
+
attention_dropout=0.0,
|
| 178 |
+
**kwargs,
|
| 179 |
+
):
|
| 180 |
+
self.vocab_size = vocab_size
|
| 181 |
+
self.max_position_embeddings = max_position_embeddings
|
| 182 |
+
self.hidden_size = hidden_size
|
| 183 |
+
self.intermediate_size = intermediate_size
|
| 184 |
+
self.num_hidden_layers = num_hidden_layers
|
| 185 |
+
self.num_attention_heads = num_attention_heads
|
| 186 |
+
self.use_sliding_window = use_sliding_window
|
| 187 |
+
self.sliding_window = sliding_window if self.use_sliding_window else None
|
| 188 |
+
self.max_window_layers = max_window_layers
|
| 189 |
+
|
| 190 |
+
# for backward compatibility
|
| 191 |
+
if num_key_value_heads is None:
|
| 192 |
+
num_key_value_heads = num_attention_heads
|
| 193 |
+
|
| 194 |
+
self.num_key_value_heads = num_key_value_heads
|
| 195 |
+
self.head_dim = head_dim
|
| 196 |
+
self.hidden_act = hidden_act
|
| 197 |
+
self.initializer_range = initializer_range
|
| 198 |
+
self.rms_norm_eps = rms_norm_eps
|
| 199 |
+
self.use_cache = use_cache
|
| 200 |
+
self.rope_theta = rope_theta
|
| 201 |
+
self.rope_scaling = rope_scaling
|
| 202 |
+
self.attention_bias = attention_bias
|
| 203 |
+
self.attention_dropout = attention_dropout
|
| 204 |
+
# Validate the correctness of rotary position embeddings parameters
|
| 205 |
+
# BC: if there is a 'type' field, move it to 'rope_type'.
|
| 206 |
+
if self.rope_scaling is not None and "type" in self.rope_scaling:
|
| 207 |
+
self.rope_scaling["rope_type"] = self.rope_scaling["type"]
|
| 208 |
+
rope_config_validation(self)
|
| 209 |
+
|
| 210 |
+
self.layer_types = layer_types
|
| 211 |
+
if self.layer_types is None:
|
| 212 |
+
self.layer_types = [
|
| 213 |
+
"sliding_attention"
|
| 214 |
+
if self.sliding_window is not None and i >= self.max_window_layers
|
| 215 |
+
else "full_attention"
|
| 216 |
+
for i in range(self.num_hidden_layers)
|
| 217 |
+
]
|
| 218 |
+
|
| 219 |
+
super().__init__(
|
| 220 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 221 |
+
**kwargs,
|
| 222 |
+
)
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
__all__ = ["Qwen3TSConfig"]
|
generation_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645,
|
| 6 |
+
151643
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 151643,
|
| 9 |
+
"temperature": 0.6,
|
| 10 |
+
"top_k": 20,
|
| 11 |
+
"top_p": 0.95,
|
| 12 |
+
"transformers_version": "4.52.4"
|
| 13 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
modeling_qwen3_ts.py
ADDED
|
@@ -0,0 +1,622 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
from typing import Callable, Optional, Union
|
| 16 |
+
|
| 17 |
+
import torch
|
| 18 |
+
from torch import nn
|
| 19 |
+
from dataclasses import dataclass
|
| 20 |
+
|
| 21 |
+
from transformers.cache_utils import Cache
|
| 22 |
+
from transformers.generation import GenerationMixin
|
| 23 |
+
from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
|
| 24 |
+
from transformers.modeling_outputs import (
|
| 25 |
+
BaseModelOutputWithPast,
|
| 26 |
+
CausalLMOutputWithPast
|
| 27 |
+
)
|
| 28 |
+
from transformers.models.qwen3.modeling_qwen3 import Qwen3PreTrainedModel, Qwen3Model
|
| 29 |
+
from transformers.modeling_utils import PreTrainedModel
|
| 30 |
+
from transformers.processing_utils import Unpack
|
| 31 |
+
from transformers.utils import LossKwargs, auto_docstring, can_return_tuple, logging, ModelOutput
|
| 32 |
+
from .configuration_qwen3_ts import Qwen3TSConfig
|
| 33 |
+
from typing import Any, Dict
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
logger = logging.get_logger(__name__)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
########################MLP TS Embedding#####################
|
| 40 |
+
class TimeSeriesEmbedding(nn.Module):
|
| 41 |
+
def __init__(self, config):
|
| 42 |
+
super(TimeSeriesEmbedding, self).__init__()
|
| 43 |
+
self.patch_size = config['patch_size']
|
| 44 |
+
self.num_layers = config['num_layers']
|
| 45 |
+
self.hidden_size = config['hidden_size']
|
| 46 |
+
self.num_features = config['num_features']
|
| 47 |
+
self.max_sequence_length = config['max_sequence_length'] # Maximum time series length
|
| 48 |
+
self.use_position_embedding = config.get('use_position_embedding', False)
|
| 49 |
+
self.use_position_idx = config.get('use_position_idx', False)
|
| 50 |
+
self.use_layer_norm = config.get('use_layer_norm', False)
|
| 51 |
+
self.embedding_dim = config.get('embedding_dim', 16) # Embedding dimension
|
| 52 |
+
|
| 53 |
+
if self.use_position_embedding:
|
| 54 |
+
# Extended vocabulary: [0, max_sequence_length) for real positions, max_sequence_length for padding
|
| 55 |
+
self.position_embedding = nn.Embedding(self.max_sequence_length + 1, self.embedding_dim)
|
| 56 |
+
self.padding_idx = self.max_sequence_length # Special index for padding
|
| 57 |
+
input_size = 1 * self.patch_size + self.embedding_dim * self.patch_size
|
| 58 |
+
elif self.use_position_idx:
|
| 59 |
+
input_size = 2 * self.patch_size
|
| 60 |
+
else:
|
| 61 |
+
input_size = 1 * self.patch_size
|
| 62 |
+
|
| 63 |
+
# Build MLP layers
|
| 64 |
+
layers = []
|
| 65 |
+
for _ in range(self.num_layers - 1):
|
| 66 |
+
layers.append(nn.Linear(input_size, self.hidden_size))
|
| 67 |
+
layers.append(nn.GELU())
|
| 68 |
+
input_size = self.hidden_size
|
| 69 |
+
|
| 70 |
+
layers.append(nn.Linear(input_size, self.hidden_size))
|
| 71 |
+
if self.use_layer_norm:
|
| 72 |
+
layers.append(nn.LayerNorm(self.hidden_size))
|
| 73 |
+
|
| 74 |
+
self.mlp = nn.Sequential(*layers)
|
| 75 |
+
|
| 76 |
+
def forward(self, x: torch.Tensor):
|
| 77 |
+
batch_size = x.size(0)
|
| 78 |
+
x = x.reshape(batch_size, -1, self.num_features)
|
| 79 |
+
|
| 80 |
+
# Extract mask and calculate valid lengths
|
| 81 |
+
mask = x[:, :, -1].long()
|
| 82 |
+
valid_lengths = mask.sum(dim=1).long()
|
| 83 |
+
patch_cnt = (valid_lengths + self.patch_size - 1) // self.patch_size
|
| 84 |
+
|
| 85 |
+
patches_list = []
|
| 86 |
+
# Collect position indices for batch embedding lookup
|
| 87 |
+
all_position_indices = []
|
| 88 |
+
patch_info_list = [] # Store metadata for each patch group
|
| 89 |
+
|
| 90 |
+
for i in range(batch_size):
|
| 91 |
+
vl = valid_lengths[i].item()
|
| 92 |
+
pc = patch_cnt[i].item()
|
| 93 |
+
if pc == 0:
|
| 94 |
+
continue
|
| 95 |
+
|
| 96 |
+
# Extract time series data (excluding mask)
|
| 97 |
+
xi = x[i, :vl, :1] # Time-series data
|
| 98 |
+
total_padded_length = pc * self.patch_size
|
| 99 |
+
padding_length = total_padded_length - vl
|
| 100 |
+
|
| 101 |
+
# Create position indices: real positions for actual data, special index for padding
|
| 102 |
+
position_indices = torch.arange(vl, device=x.device)
|
| 103 |
+
|
| 104 |
+
if padding_length > 0:
|
| 105 |
+
# Pad with last value
|
| 106 |
+
last_value = xi[-1:, :]
|
| 107 |
+
padding = last_value.repeat(padding_length, 1)
|
| 108 |
+
xi = torch.cat([xi, padding], dim=0)
|
| 109 |
+
|
| 110 |
+
# Use special padding index for padding positions
|
| 111 |
+
padding_positions = torch.full((padding_length,), self.padding_idx, device=x.device)
|
| 112 |
+
position_indices = torch.cat([position_indices, padding_positions], dim=0)
|
| 113 |
+
|
| 114 |
+
# Reshape to patches
|
| 115 |
+
xi = xi.reshape(pc, self.patch_size) # (num_patches, patch_size)
|
| 116 |
+
position_indices = position_indices.reshape(pc, self.patch_size) # (num_patches, patch_size)
|
| 117 |
+
|
| 118 |
+
if self.use_position_embedding:
|
| 119 |
+
# Collect position indices instead of calling embedding immediately
|
| 120 |
+
all_position_indices.append(position_indices)
|
| 121 |
+
patch_info_list.append({
|
| 122 |
+
'xi': xi,
|
| 123 |
+
'pc': pc,
|
| 124 |
+
'sample_idx': i
|
| 125 |
+
})
|
| 126 |
+
elif self.use_position_idx:
|
| 127 |
+
# Normalize position indices
|
| 128 |
+
pos_indices = torch.arange(vl, device=x.device).unsqueeze(1)
|
| 129 |
+
pos_indices = pos_indices / max(1, valid_lengths.max().item() - 1)
|
| 130 |
+
if padding_length > 0:
|
| 131 |
+
# Use -1 for padding positions
|
| 132 |
+
padding_indices = torch.full((padding_length, 1), -1, device=x.device)
|
| 133 |
+
pos_indices = torch.cat([pos_indices, padding_indices], dim=0)
|
| 134 |
+
# Combine time series data with position indices
|
| 135 |
+
xi_combined = torch.cat([xi.reshape(-1, 1), pos_indices], dim=1)
|
| 136 |
+
patch_input = xi_combined.reshape(pc, self.patch_size * 2)
|
| 137 |
+
patches_list.append(patch_input)
|
| 138 |
+
else:
|
| 139 |
+
# No position embedding, use raw patches
|
| 140 |
+
patch_input = xi
|
| 141 |
+
patches_list.append(patch_input)
|
| 142 |
+
|
| 143 |
+
# Batch process position embeddings if needed
|
| 144 |
+
if self.use_position_embedding and all_position_indices:
|
| 145 |
+
# Concatenate all position indices for batch embedding lookup
|
| 146 |
+
batch_position_indices = torch.cat(all_position_indices, dim=0)
|
| 147 |
+
# print(f"{x.shape=}, {x.device=}, {len(all_position_indices)=}, {batch_position_indices=}")
|
| 148 |
+
batch_pos_emb = self.position_embedding(batch_position_indices) # Single embedding call
|
| 149 |
+
|
| 150 |
+
# Split embeddings back and create patch inputs
|
| 151 |
+
emb_start_idx = 0
|
| 152 |
+
for patch_info in patch_info_list:
|
| 153 |
+
xi = patch_info['xi']
|
| 154 |
+
pc = patch_info['pc']
|
| 155 |
+
|
| 156 |
+
# Extract corresponding embeddings
|
| 157 |
+
pos_emb = batch_pos_emb[emb_start_idx:emb_start_idx + pc]
|
| 158 |
+
emb_start_idx += pc
|
| 159 |
+
|
| 160 |
+
# Flatten and concatenate
|
| 161 |
+
xi = xi.unsqueeze(-1) # (num_patches, patch_size, 1)
|
| 162 |
+
patch_input = torch.cat([
|
| 163 |
+
xi.flatten(1), # (num_patches, patch_size)
|
| 164 |
+
pos_emb.flatten(1) # (num_patches, patch_size * embedding_dim)
|
| 165 |
+
], dim=1)
|
| 166 |
+
patches_list.append(patch_input)
|
| 167 |
+
|
| 168 |
+
# Process all patches through MLP
|
| 169 |
+
if patches_list:
|
| 170 |
+
x_patches = torch.cat(patches_list, dim=0)
|
| 171 |
+
x = self.mlp(x_patches)
|
| 172 |
+
else:
|
| 173 |
+
# Handle empty case
|
| 174 |
+
x = torch.empty(0, self.hidden_size, device=x.device)
|
| 175 |
+
|
| 176 |
+
return x, patch_cnt
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
@dataclass
|
| 180 |
+
class Qwen3TSCausalLMOutputWithPast(CausalLMOutputWithPast):
|
| 181 |
+
"""
|
| 182 |
+
Output type of Qwen3TSForCausalLM that includes additional fields for timeseries processing.
|
| 183 |
+
|
| 184 |
+
Args:
|
| 185 |
+
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
|
| 186 |
+
Language modeling loss (for next-token prediction).
|
| 187 |
+
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
|
| 188 |
+
Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
|
| 189 |
+
past_key_values (`tuple(tuple(torch.FloatTensor))`, *optional*, returned when `use_cache=True` is passed):
|
| 190 |
+
Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of shape
|
| 191 |
+
`(batch_size, num_heads, sequence_length, embed_size_per_head)`.
|
| 192 |
+
hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed):
|
| 193 |
+
Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
|
| 194 |
+
one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
|
| 195 |
+
attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed):
|
| 196 |
+
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, sequence_length)`.
|
| 197 |
+
attention_mask (`torch.FloatTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 198 |
+
The attention mask used in the forward pass, potentially expanded to accommodate timeseries patches.
|
| 199 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 200 |
+
Labels for computing the masked language modeling loss.
|
| 201 |
+
new_token_positions (`torch.LongTensor` of shape `(batch_size, num_new_tokens)`, *optional*):
|
| 202 |
+
Positions where new tokens (not from timeseries) are located in the expanded sequence.
|
| 203 |
+
"""
|
| 204 |
+
attention_mask: Optional[torch.FloatTensor] = None
|
| 205 |
+
labels: Optional[torch.LongTensor] = None
|
| 206 |
+
new_token_positions: Optional[torch.LongTensor] = None
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
class KwargsForCausalLM(FlashAttentionKwargs, LossKwargs): ...
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
class Qwen3TSGenerationMixin(GenerationMixin):
|
| 213 |
+
"""
|
| 214 |
+
Generation mixin for Qwen3 models with timeseries support.
|
| 215 |
+
|
| 216 |
+
This mixin handles the special case where timeseries embeddings expand the sequence length
|
| 217 |
+
during the first forward pass, requiring special attention mask management.
|
| 218 |
+
"""
|
| 219 |
+
|
| 220 |
+
def prepare_inputs_for_generation(
|
| 221 |
+
self,
|
| 222 |
+
input_ids: torch.LongTensor,
|
| 223 |
+
past_key_values: Optional[Cache] = None,
|
| 224 |
+
attention_mask: Optional[torch.LongTensor] = None,
|
| 225 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 226 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 227 |
+
timeseries: Optional[torch.FloatTensor] = None,
|
| 228 |
+
**kwargs,
|
| 229 |
+
) -> Dict[str, Any]:
|
| 230 |
+
"""
|
| 231 |
+
Prepare inputs for generation with timeseries support.
|
| 232 |
+
|
| 233 |
+
Timeseries are only processed during the first forward pass. In subsequent
|
| 234 |
+
generation steps, they are already embedded in the past_key_values.
|
| 235 |
+
"""
|
| 236 |
+
# Check if we have timeseries data
|
| 237 |
+
has_ts = timeseries is not None and len(timeseries) > 0
|
| 238 |
+
|
| 239 |
+
# Handle timeseries for generation with past_key_values
|
| 240 |
+
if has_ts and past_key_values is not None:
|
| 241 |
+
# Get the number of tokens already processed
|
| 242 |
+
if isinstance(past_key_values, Cache):
|
| 243 |
+
past_length = past_key_values.seen_tokens
|
| 244 |
+
else:
|
| 245 |
+
past_length = past_key_values[0][0].shape[2] if past_key_values[0] is not None else 0
|
| 246 |
+
|
| 247 |
+
# If we have processed tokens, timeseries have already been embedded
|
| 248 |
+
if past_length > 0:
|
| 249 |
+
# Only keep the last token for next token prediction
|
| 250 |
+
input_ids = input_ids[:, -1:]
|
| 251 |
+
# Clear timeseries as they've been processed
|
| 252 |
+
timeseries = None
|
| 253 |
+
has_ts = False
|
| 254 |
+
|
| 255 |
+
# Call parent's prepare_inputs_for_generation to handle all standard logic
|
| 256 |
+
model_inputs = super().prepare_inputs_for_generation(
|
| 257 |
+
input_ids=input_ids,
|
| 258 |
+
past_key_values=past_key_values,
|
| 259 |
+
attention_mask=attention_mask,
|
| 260 |
+
inputs_embeds=inputs_embeds,
|
| 261 |
+
cache_position=cache_position,
|
| 262 |
+
**kwargs
|
| 263 |
+
)
|
| 264 |
+
|
| 265 |
+
# Add timeseries to model inputs
|
| 266 |
+
model_inputs["timeseries"] = timeseries
|
| 267 |
+
|
| 268 |
+
return model_inputs
|
| 269 |
+
|
| 270 |
+
def _update_model_kwargs_for_generation(
|
| 271 |
+
self,
|
| 272 |
+
outputs: ModelOutput,
|
| 273 |
+
model_kwargs: Dict[str, Any],
|
| 274 |
+
is_encoder_decoder: bool = False,
|
| 275 |
+
num_new_tokens: int = 1,
|
| 276 |
+
) -> Dict[str, Any]:
|
| 277 |
+
"""
|
| 278 |
+
Update model keyword arguments for generation, handling attention mask from outputs.
|
| 279 |
+
|
| 280 |
+
This is necessary because timeseries processing can expand the sequence length,
|
| 281 |
+
and we need to use the expanded attention_mask from the model outputs.
|
| 282 |
+
"""
|
| 283 |
+
# Handle special case: use attention_mask from outputs if available
|
| 284 |
+
# This is crucial for timeseries models where the sequence length is expanded
|
| 285 |
+
if hasattr(outputs, "attention_mask") and outputs.attention_mask is not None:
|
| 286 |
+
model_kwargs["attention_mask"] = outputs.attention_mask
|
| 287 |
+
|
| 288 |
+
# Call parent's implementation for standard updates
|
| 289 |
+
model_kwargs = super()._update_model_kwargs_for_generation(
|
| 290 |
+
outputs=outputs,
|
| 291 |
+
model_kwargs=model_kwargs,
|
| 292 |
+
is_encoder_decoder=is_encoder_decoder,
|
| 293 |
+
num_new_tokens=num_new_tokens,
|
| 294 |
+
)
|
| 295 |
+
|
| 296 |
+
return model_kwargs
|
| 297 |
+
|
| 298 |
+
def generate(
|
| 299 |
+
self,
|
| 300 |
+
inputs: Optional[torch.Tensor] = None,
|
| 301 |
+
timeseries: Optional[torch.FloatTensor] = None,
|
| 302 |
+
generation_config=None,
|
| 303 |
+
**kwargs,
|
| 304 |
+
):
|
| 305 |
+
"""
|
| 306 |
+
Generate sequences with timeseries support.
|
| 307 |
+
|
| 308 |
+
Args:
|
| 309 |
+
inputs: Input token ids
|
| 310 |
+
timeseries: Optional timeseries data to be processed in the first forward pass
|
| 311 |
+
generation_config: Generation configuration
|
| 312 |
+
**kwargs: Additional keyword arguments for generation
|
| 313 |
+
"""
|
| 314 |
+
# Add timeseries to kwargs if provided
|
| 315 |
+
if timeseries is not None:
|
| 316 |
+
kwargs["timeseries"] = timeseries
|
| 317 |
+
|
| 318 |
+
# Call parent's generate method
|
| 319 |
+
return super().generate(
|
| 320 |
+
inputs=inputs,
|
| 321 |
+
generation_config=generation_config,
|
| 322 |
+
**kwargs,
|
| 323 |
+
)
|
| 324 |
+
|
| 325 |
+
def _validate_model_kwargs(self, model_kwargs: Dict[str, Any]) -> None:
|
| 326 |
+
"""
|
| 327 |
+
Validate model kwargs, allowing timeseries as a valid argument.
|
| 328 |
+
"""
|
| 329 |
+
# Remove timeseries from model_kwargs temporarily for validation
|
| 330 |
+
timeseries = model_kwargs.pop("timeseries", None)
|
| 331 |
+
|
| 332 |
+
# Call parent's validation
|
| 333 |
+
super()._validate_model_kwargs(model_kwargs)
|
| 334 |
+
|
| 335 |
+
# Restore timeseries
|
| 336 |
+
if timeseries is not None:
|
| 337 |
+
model_kwargs["timeseries"] = timeseries
|
| 338 |
+
|
| 339 |
+
class Qwen3TSPreTrainedModel(Qwen3PreTrainedModel):
|
| 340 |
+
config_class = Qwen3TSConfig
|
| 341 |
+
|
| 342 |
+
@auto_docstring
|
| 343 |
+
class Qwen3TSForCausalLM(Qwen3TSPreTrainedModel, Qwen3TSGenerationMixin):
|
| 344 |
+
_tied_weights_keys = ["lm_head.weight"]
|
| 345 |
+
_tp_plan = {"lm_head": "colwise_rep"}
|
| 346 |
+
_pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
|
| 347 |
+
|
| 348 |
+
def __init__(self, config):
|
| 349 |
+
super().__init__(config)
|
| 350 |
+
self.model = Qwen3Model(config)
|
| 351 |
+
self.vocab_size = config.vocab_size
|
| 352 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 353 |
+
|
| 354 |
+
# TS embedding
|
| 355 |
+
self.ts_encoder = TimeSeriesEmbedding(config.ts)
|
| 356 |
+
|
| 357 |
+
# Initialize weights and apply final processing
|
| 358 |
+
self.post_init()
|
| 359 |
+
|
| 360 |
+
def get_input_embeddings(self):
|
| 361 |
+
return self.model.embed_tokens
|
| 362 |
+
|
| 363 |
+
def set_input_embeddings(self, value):
|
| 364 |
+
self.model.embed_tokens = value
|
| 365 |
+
|
| 366 |
+
def get_output_embeddings(self):
|
| 367 |
+
return self.lm_head
|
| 368 |
+
|
| 369 |
+
def set_output_embeddings(self, new_embeddings):
|
| 370 |
+
self.lm_head = new_embeddings
|
| 371 |
+
|
| 372 |
+
def set_decoder(self, decoder):
|
| 373 |
+
self.model = decoder
|
| 374 |
+
|
| 375 |
+
def get_decoder(self):
|
| 376 |
+
return self.model
|
| 377 |
+
|
| 378 |
+
def _merge_input_ids_with_time_series_features(self, time_series_features, inputs_embeds, input_ids, attention_mask, labels, patch_cnt):
|
| 379 |
+
batch_size, sequence_length = input_ids.shape
|
| 380 |
+
_left_padding = torch.any(attention_mask[:, 0] == 0)
|
| 381 |
+
_right_padding = torch.any(attention_mask[:, -1] == 0)
|
| 382 |
+
left_padding = False
|
| 383 |
+
if batch_size > 1:
|
| 384 |
+
if _left_padding and not _right_padding:
|
| 385 |
+
left_padding = True
|
| 386 |
+
elif not _left_padding and _right_padding:
|
| 387 |
+
left_padding = False
|
| 388 |
+
elif not _left_padding and not _right_padding:
|
| 389 |
+
left_padding = False
|
| 390 |
+
else:
|
| 391 |
+
raise ValueError(f"both side of attention_mask has zero, invalid. {attention_mask}")
|
| 392 |
+
else:
|
| 393 |
+
if _left_padding and not _right_padding:
|
| 394 |
+
left_padding = True
|
| 395 |
+
else:
|
| 396 |
+
left_padding = False
|
| 397 |
+
|
| 398 |
+
# 1. Create a mask to know where special time series tokens are
|
| 399 |
+
special_ts_token_mask_start = input_ids == self.config.ts_token_start_index
|
| 400 |
+
special_ts_token_mask_end = input_ids == self.config.ts_token_end_index
|
| 401 |
+
special_ts_token_mask = special_ts_token_mask_start | special_ts_token_mask_end
|
| 402 |
+
|
| 403 |
+
# 2. Calculate patch count
|
| 404 |
+
num_special_ts_tokens = torch.sum(special_ts_token_mask_start, dim=-1)
|
| 405 |
+
total_time_steps, embed_dim = time_series_features.shape
|
| 406 |
+
|
| 407 |
+
# Correctly calculate the total number of patches per batch
|
| 408 |
+
patch_index = 0
|
| 409 |
+
num_total_patches = torch.zeros(batch_size, dtype=patch_cnt.dtype, device=patch_cnt.device)
|
| 410 |
+
special_ts_token_mask_start_nonzero = special_ts_token_mask_start.nonzero()
|
| 411 |
+
special_ts_token_mask_start_with_size = special_ts_token_mask_start.clone().long()
|
| 412 |
+
|
| 413 |
+
attn_mask_cnt = attention_mask.sum(dim=-1)
|
| 414 |
+
for i in range(batch_size):
|
| 415 |
+
num_ts_in_batch = num_special_ts_tokens[i]
|
| 416 |
+
num_total_patches[i] = patch_cnt[patch_index : patch_index + num_ts_in_batch].sum() - 2 * num_ts_in_batch
|
| 417 |
+
for idx in range(patch_index, patch_index + num_ts_in_batch):
|
| 418 |
+
b_idx, pos = special_ts_token_mask_start_nonzero[idx]
|
| 419 |
+
special_ts_token_mask_start_with_size[b_idx, pos] *= (patch_cnt[idx].item() - 2)
|
| 420 |
+
patch_index += num_ts_in_batch
|
| 421 |
+
attn_mask_cnt[i] += num_total_patches[i].item()
|
| 422 |
+
|
| 423 |
+
# 3. Embeding length
|
| 424 |
+
max_embed_dim = sequence_length + num_total_patches.max()
|
| 425 |
+
|
| 426 |
+
# 4. Non ts tokens
|
| 427 |
+
batch_indices, non_ts_indices = torch.where(~special_ts_token_mask)
|
| 428 |
+
attn_batch_indices, attn_indices = torch.where(attention_mask == 1)
|
| 429 |
+
|
| 430 |
+
# 5. Text token in final text positions
|
| 431 |
+
new_token_positions = torch.cumsum((special_ts_token_mask_start_with_size + 1), dim=-1) - 1
|
| 432 |
+
|
| 433 |
+
# nb_ts_pad
|
| 434 |
+
nb_ts_pad = max_embed_dim - 1 - new_token_positions[:, -1]
|
| 435 |
+
if left_padding:
|
| 436 |
+
new_token_positions += nb_ts_pad[:, None]
|
| 437 |
+
|
| 438 |
+
text_to_overwrite = new_token_positions[batch_indices, non_ts_indices]
|
| 439 |
+
|
| 440 |
+
# 6. Final embedding and attention masks
|
| 441 |
+
final_embedding = torch.zeros(
|
| 442 |
+
batch_size, max_embed_dim, embed_dim, dtype=inputs_embeds.dtype, device=inputs_embeds.device
|
| 443 |
+
)
|
| 444 |
+
|
| 445 |
+
final_attention_mask = torch.zeros(batch_size, max_embed_dim, dtype=attention_mask.dtype, device=inputs_embeds.device)
|
| 446 |
+
for i in range(attention_mask.size(0)):
|
| 447 |
+
if left_padding:
|
| 448 |
+
final_attention_mask[i, max_embed_dim - attn_mask_cnt[i] :] = 1
|
| 449 |
+
else:
|
| 450 |
+
final_attention_mask[i, : attn_mask_cnt[i]] = 1
|
| 451 |
+
|
| 452 |
+
final_labels = None
|
| 453 |
+
if labels is not None:
|
| 454 |
+
final_labels = torch.full(
|
| 455 |
+
(batch_size, max_embed_dim), self.config.ignore_index, dtype=input_ids.dtype, device=input_ids.device
|
| 456 |
+
)
|
| 457 |
+
|
| 458 |
+
target_device = inputs_embeds.device
|
| 459 |
+
batch_indices, non_ts_indices, text_to_overwrite = (
|
| 460 |
+
batch_indices.to(target_device),
|
| 461 |
+
non_ts_indices.to(target_device),
|
| 462 |
+
text_to_overwrite.to(target_device),
|
| 463 |
+
)
|
| 464 |
+
|
| 465 |
+
# 7. Move embedding and labels to final positions
|
| 466 |
+
final_embedding[batch_indices, text_to_overwrite] = inputs_embeds[batch_indices, non_ts_indices]
|
| 467 |
+
if labels is not None:
|
| 468 |
+
final_labels[batch_indices, text_to_overwrite] = labels[batch_indices, non_ts_indices]
|
| 469 |
+
|
| 470 |
+
# 8. Move time series to final positions
|
| 471 |
+
ts_to_overwrite = torch.full(
|
| 472 |
+
(batch_size, max_embed_dim), True, dtype=torch.bool, device=inputs_embeds.device
|
| 473 |
+
)
|
| 474 |
+
ts_to_overwrite[batch_indices, text_to_overwrite] = False
|
| 475 |
+
|
| 476 |
+
reversed_cumsum = ts_to_overwrite.flip(dims=[-1]).cumsum(-1).flip(dims=[-1]) - 1
|
| 477 |
+
ts_to_overwrite &= reversed_cumsum >= nb_ts_pad[:, None].to(target_device)
|
| 478 |
+
|
| 479 |
+
# Check that the number of time series tokens is correct
|
| 480 |
+
if ts_to_overwrite.sum() != time_series_features.shape[:-1].numel():
|
| 481 |
+
raise ValueError(
|
| 482 |
+
f"The input provided to the model are wrong. The number of time series tokens is {torch.sum(special_ts_token_mask_start)} while"
|
| 483 |
+
f" the number of time series given to the model is {len(patch_cnt)}. This prevents correct indexing and breaks batch generation."
|
| 484 |
+
)
|
| 485 |
+
final_embedding[ts_to_overwrite] = time_series_features.contiguous().reshape(-1, embed_dim).to(target_device)
|
| 486 |
+
# if str(input_ids.device) == 'cuda:0':
|
| 487 |
+
# print(f"[EMBED] {final_embedding[ts_to_overwrite][0]=}")
|
| 488 |
+
|
| 489 |
+
# 9. Calculate position ids
|
| 490 |
+
position_ids = (final_attention_mask.cumsum(-1) - 1).masked_fill_((final_attention_mask == 0), 1)
|
| 491 |
+
if position_ids.size(-1) < input_ids.size(-1):
|
| 492 |
+
position_ids = position_ids[:, -input_ids.size(-1) :]
|
| 493 |
+
|
| 494 |
+
# 10. Move attention mask to final positions
|
| 495 |
+
# print(f"{type(input_ids)=}, {input_ids.shape=}, {self.config.pad_token_id=}")
|
| 496 |
+
pad_batch_indices, pad_indices = torch.where(input_ids == self.config.pad_token_id)
|
| 497 |
+
if len(pad_batch_indices) > 0:
|
| 498 |
+
indices_to_mask = new_token_positions[pad_batch_indices, pad_indices]
|
| 499 |
+
final_embedding[pad_batch_indices, indices_to_mask] = 0
|
| 500 |
+
|
| 501 |
+
# 11. Post-process new_token_positions (set -1 for padding positions)
|
| 502 |
+
new_token_positions = new_token_positions.masked_fill(attention_mask == 0, -1)
|
| 503 |
+
|
| 504 |
+
return final_embedding, final_attention_mask, position_ids, final_labels, new_token_positions
|
| 505 |
+
|
| 506 |
+
@can_return_tuple
|
| 507 |
+
def forward(
|
| 508 |
+
self,
|
| 509 |
+
input_ids: Optional[torch.LongTensor] = None,
|
| 510 |
+
timeseries: torch.FloatTensor = None,
|
| 511 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 512 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 513 |
+
past_key_values: Optional[Cache] = None,
|
| 514 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 515 |
+
labels: Optional[torch.LongTensor] = None,
|
| 516 |
+
use_cache: Optional[bool] = None,
|
| 517 |
+
output_attentions: Optional[bool] = None,
|
| 518 |
+
output_hidden_states: Optional[bool] = None,
|
| 519 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 520 |
+
logits_to_keep: Union[int, torch.Tensor] = 0,
|
| 521 |
+
**kwargs: Unpack[KwargsForCausalLM],
|
| 522 |
+
) -> Qwen3TSCausalLMOutputWithPast:
|
| 523 |
+
r"""
|
| 524 |
+
Args:
|
| 525 |
+
input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
|
| 526 |
+
Indices of input sequence tokens in the vocabulary.
|
| 527 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 528 |
+
Mask to avoid performing attention on padding token indices.
|
| 529 |
+
position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 530 |
+
Indices of positions of each input sequence tokens in the position embeddings.
|
| 531 |
+
past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):
|
| 532 |
+
Pre-computed hidden-states (key and values in the attention blocks).
|
| 533 |
+
inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
|
| 534 |
+
Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation.
|
| 535 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 536 |
+
Labels for computing the masked language modeling loss.
|
| 537 |
+
use_cache (`bool`, *optional*):
|
| 538 |
+
If set to `True`, `past_key_values` key value states are returned.
|
| 539 |
+
output_attentions (`bool`, *optional*):
|
| 540 |
+
Whether or not to return the attentions tensors of all attention layers.
|
| 541 |
+
output_hidden_states (`bool`, *optional*):
|
| 542 |
+
Whether or not to return the hidden states of all layers.
|
| 543 |
+
return_dict (`bool`, *optional*):
|
| 544 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
| 545 |
+
cache_position (`torch.LongTensor` of shape `(sequence_length)`, *optional*):
|
| 546 |
+
Indices depicting the position of the input sequence tokens in the sequence.
|
| 547 |
+
timeseries (`torch.FloatTensor` of shape `(batch_size, num_patches, patch_size)`, *optional*):
|
| 548 |
+
Timeseries data to be encoded and merged with text embeddings.
|
| 549 |
+
|
| 550 |
+
Returns:
|
| 551 |
+
[`Qwen3TSCausalLMOutputWithPast`] or `tuple(torch.FloatTensor)`:
|
| 552 |
+
The model outputs with potential timeseries-expanded attention mask.
|
| 553 |
+
"""
|
| 554 |
+
|
| 555 |
+
# if input_ids is not None and timeseries is not None:
|
| 556 |
+
# # Print the input ts
|
| 557 |
+
# print("=================================================================")
|
| 558 |
+
# print("Timeseries shape:", timeseries.shape)
|
| 559 |
+
# print("=================================================================\n\n")
|
| 560 |
+
# else:
|
| 561 |
+
# print("Time series is None!!!!")
|
| 562 |
+
|
| 563 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
| 564 |
+
output_hidden_states = (
|
| 565 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 566 |
+
)
|
| 567 |
+
|
| 568 |
+
if inputs_embeds is None:
|
| 569 |
+
inputs_embeds = self.get_input_embeddings()(input_ids)
|
| 570 |
+
|
| 571 |
+
if timeseries is not None and timeseries.shape[0] > 0:
|
| 572 |
+
# use_cache = False
|
| 573 |
+
# print(f"timeseries shape: {timeseries.shape=}, {input_ids.shape=}")
|
| 574 |
+
ts_features, patch_cnt = self.ts_encoder(timeseries)
|
| 575 |
+
inputs_embeds = inputs_embeds.to(ts_features.dtype)
|
| 576 |
+
# if str(input_ids.device) == 'cuda:0':
|
| 577 |
+
# print(f"-------------------------------------------------------\n[before] {input_ids.shape=}, timeseries={timeseries.shape if timeseries is not None else None}, {attention_mask.sum(-1)=}")
|
| 578 |
+
inputs_embeds, attention_mask, position_ids, labels, new_token_positions = self._merge_input_ids_with_time_series_features(
|
| 579 |
+
ts_features, inputs_embeds, input_ids, attention_mask, labels, patch_cnt
|
| 580 |
+
)
|
| 581 |
+
# print(f"{inputs_embeds.shape=}, {attention_mask.shape=}, {position_ids.shape=}, {labels.shape=}")
|
| 582 |
+
|
| 583 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
| 584 |
+
# if str(input_ids.device) == 'cuda:0':
|
| 585 |
+
# print(f"[after] {inputs_embeds.shape=}, {attention_mask.sum(-1)=}, {position_ids.max(-1)=}, {cache_position=}")
|
| 586 |
+
outputs: BaseModelOutputWithPast = self.model(
|
| 587 |
+
attention_mask=attention_mask,
|
| 588 |
+
position_ids=position_ids,
|
| 589 |
+
past_key_values=past_key_values,
|
| 590 |
+
inputs_embeds=inputs_embeds,
|
| 591 |
+
use_cache=use_cache,
|
| 592 |
+
output_attentions=output_attentions,
|
| 593 |
+
output_hidden_states=output_hidden_states,
|
| 594 |
+
cache_position=cache_position,
|
| 595 |
+
**kwargs,
|
| 596 |
+
)
|
| 597 |
+
|
| 598 |
+
hidden_states = outputs.last_hidden_state
|
| 599 |
+
# Only compute necessary logits, and do not upcast them to float if we are not computing the loss
|
| 600 |
+
slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
|
| 601 |
+
logits = self.lm_head(hidden_states[:, slice_indices, :])
|
| 602 |
+
|
| 603 |
+
loss = None
|
| 604 |
+
if labels is not None:
|
| 605 |
+
loss = self.loss_function(logits=logits, labels=labels, vocab_size=self.config.vocab_size, **kwargs)
|
| 606 |
+
# print(f"{logits.shape=}, {hidden_states.shape=}, {slice_indices=}, {logits_to_keep=}, labels={(labels != self.config.ignore_index).sum() if labels is not None else None}, {loss=}, {torch.sum(torch.isnan(logits))=}, {torch.sum(torch.isinf(logits))=}, {torch.sum(torch.isnan(hidden_states))=}, {torch.sum(torch.isinf(hidden_states))=}")
|
| 607 |
+
|
| 608 |
+
return Qwen3TSCausalLMOutputWithPast(
|
| 609 |
+
loss=loss,
|
| 610 |
+
logits=logits,
|
| 611 |
+
past_key_values=outputs.past_key_values,
|
| 612 |
+
hidden_states=outputs.hidden_states,
|
| 613 |
+
attentions=outputs.attentions,
|
| 614 |
+
attention_mask=attention_mask,
|
| 615 |
+
labels=labels,
|
| 616 |
+
new_token_positions=new_token_positions if timeseries is not None and timeseries.shape[0] > 0 else None,
|
| 617 |
+
)
|
| 618 |
+
|
| 619 |
+
|
| 620 |
+
__all__ = [
|
| 621 |
+
"Qwen3TSForCausalLM"
|
| 622 |
+
]
|
processing_qwen3_ts.py
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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under the MIT License (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# https://opensource.org/license/mit
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
|
| 16 |
+
import numpy as np
|
| 17 |
+
from typing import List, Union, Tuple, Optional
|
| 18 |
+
import torch
|
| 19 |
+
|
| 20 |
+
from transformers.feature_extraction_utils import BatchFeature
|
| 21 |
+
from transformers.processing_utils import ProcessorMixin
|
| 22 |
+
from transformers.tokenization_utils_base import PaddingStrategy
|
| 23 |
+
|
| 24 |
+
def sp_encoding(timeseries: np.ndarray, eots_token: bool = True) -> Tuple[np.ndarray, str, dict]:
|
| 25 |
+
"""
|
| 26 |
+
Encodes a time series with scalar normalization.
|
| 27 |
+
|
| 28 |
+
Args:
|
| 29 |
+
timeseries (np.ndarray): The raw time series data (1D or 2D).
|
| 30 |
+
|
| 31 |
+
Returns:
|
| 32 |
+
result_timeseries (np.ndarray): The encoded time series, shape [seq_len, 1].
|
| 33 |
+
prompt (str): The placeholder string with offset and scaling info.
|
| 34 |
+
metadata (dict): Metadata containing the offset and scaling factor.
|
| 35 |
+
"""
|
| 36 |
+
timeseries = np.array(timeseries)
|
| 37 |
+
mean = np.mean(timeseries)
|
| 38 |
+
scaled_timeseries = timeseries - mean
|
| 39 |
+
scale_factor = 1.0
|
| 40 |
+
if np.any(np.abs(scaled_timeseries) >= 3.0):
|
| 41 |
+
scale_factor = np.max(np.abs(scaled_timeseries)) / 3.0
|
| 42 |
+
scaled_timeseries /= scale_factor
|
| 43 |
+
|
| 44 |
+
prompt = f"[offset={-mean:.4f}|scaling={scale_factor:.4f}|length={len(timeseries)}|max={max(timeseries):.4f}|min={min(timeseries):.4f}|left={timeseries[0]:.4f}|right={timeseries[-1]:.4f}]<ts>"
|
| 45 |
+
if eots_token:
|
| 46 |
+
prompt += '<ts/>'
|
| 47 |
+
|
| 48 |
+
result_timeseries = np.stack([scaled_timeseries, np.ones_like(scaled_timeseries)], axis=-1).reshape(-1, 1)
|
| 49 |
+
|
| 50 |
+
return result_timeseries, prompt, {"offset": float(-mean), "scale_factor": float(scale_factor)}
|
| 51 |
+
|
| 52 |
+
class Qwen3TSProcessor(ProcessorMixin):
|
| 53 |
+
"""
|
| 54 |
+
A processor for ChatTS that integrates text prompt processing and time series encoding.
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
attributes = ["tokenizer"]
|
| 58 |
+
feature_extractor_class = None # You can add a feature extractor if needed
|
| 59 |
+
tokenizer_class = "AutoTokenizer"
|
| 60 |
+
|
| 61 |
+
def __init__(self, tokenizer=None, chat_template=None, **kwargs):
|
| 62 |
+
"""
|
| 63 |
+
Args:
|
| 64 |
+
tokenizer: An optional tokenizer to process text prompts.
|
| 65 |
+
"""
|
| 66 |
+
if chat_template is None and tokenizer is not None and tokenizer.chat_template is not None:
|
| 67 |
+
chat_template = tokenizer.chat_template
|
| 68 |
+
self.chat_template = chat_template
|
| 69 |
+
|
| 70 |
+
super().__init__(tokenizer=tokenizer, chat_template=chat_template, **kwargs)
|
| 71 |
+
|
| 72 |
+
def __call__(
|
| 73 |
+
self,
|
| 74 |
+
text: Union[str, List[str]],
|
| 75 |
+
timeseries: Optional[List[List[np.ndarray]]] = None,
|
| 76 |
+
padding: Union[bool, str, PaddingStrategy] = False,
|
| 77 |
+
padding_side: str = 'left',
|
| 78 |
+
vllm_flag: bool = False,
|
| 79 |
+
tokenize: bool = True,
|
| 80 |
+
**kwargs,
|
| 81 |
+
) -> BatchFeature:
|
| 82 |
+
"""
|
| 83 |
+
Encodes a prompt and its associated time series.
|
| 84 |
+
|
| 85 |
+
Args:
|
| 86 |
+
prompt (List[str]): The input prompt containing <ts><ts/> placeholders.
|
| 87 |
+
timeseries (List[np.ndarray]): A list of time series matched to placeholders in the prompt.
|
| 88 |
+
padding (bool or str or PaddingStrategy, optional): Passed to the tokenizer for text padding.
|
| 89 |
+
return_tensors (str, optional): "pt" to return PyTorch tensors; None to return NumPy arrays.
|
| 90 |
+
**kwargs: Additional tokenizer parameters.
|
| 91 |
+
|
| 92 |
+
Returns:
|
| 93 |
+
BatchFeature: Contains processed prompt, encoded time series, and tokenizer outputs.
|
| 94 |
+
"""
|
| 95 |
+
if type(text) == str:
|
| 96 |
+
text = [text]
|
| 97 |
+
if timeseries is None:
|
| 98 |
+
timeseries = []
|
| 99 |
+
|
| 100 |
+
reconstructed_prompts = []
|
| 101 |
+
concatenated_ts = None
|
| 102 |
+
ts_tokens = []
|
| 103 |
+
|
| 104 |
+
if vllm_flag:
|
| 105 |
+
# All prompt modifications have to be done inside of the vLLM
|
| 106 |
+
# to work correctly with its caching mechanism.
|
| 107 |
+
reconstructed_prompts = text
|
| 108 |
+
|
| 109 |
+
# Process timeseries data
|
| 110 |
+
encoded_ts_arrays = []
|
| 111 |
+
for ts in timeseries:
|
| 112 |
+
# Get the normalized data and prompt text
|
| 113 |
+
encoded_ts, ts_prompt, _ = sp_encoding(ts, eots_token=False)
|
| 114 |
+
# Tokenize the ts_prompt and add to the tokens list
|
| 115 |
+
if self.tokenizer is not None:
|
| 116 |
+
tokens = self.tokenizer.encode(ts_prompt, add_special_tokens=False)
|
| 117 |
+
ts_tokens.append(tokens)
|
| 118 |
+
encoded_ts_arrays.append(encoded_ts[None, ...])
|
| 119 |
+
else:
|
| 120 |
+
encoded_ts_arrays = []
|
| 121 |
+
total_ts_cnt = 0
|
| 122 |
+
for idx, prompt in enumerate(text):
|
| 123 |
+
# Split prompt by <ts><ts/> placeholders
|
| 124 |
+
last_ts_cnt = total_ts_cnt
|
| 125 |
+
prompt_segments = prompt.split("<ts><ts/>")
|
| 126 |
+
total_ts_cnt = total_ts_cnt + len(prompt_segments) - 1
|
| 127 |
+
|
| 128 |
+
# Encode each time series and rebuild the prompt
|
| 129 |
+
reconstructed_prompt = prompt_segments[0]
|
| 130 |
+
|
| 131 |
+
for i, ts in enumerate(timeseries[last_ts_cnt:total_ts_cnt]):
|
| 132 |
+
encoded_ts, ts_prompt, _ = sp_encoding(ts, eots_token=not vllm_flag)
|
| 133 |
+
reconstructed_prompt += ts_prompt + prompt_segments[i + 1]
|
| 134 |
+
# Ensure time series shape [1, seq_len, feature_dim] for batch concatenation
|
| 135 |
+
encoded_ts_arrays.append(encoded_ts[None, ...])
|
| 136 |
+
|
| 137 |
+
reconstructed_prompts.append(reconstructed_prompt)
|
| 138 |
+
|
| 139 |
+
if len(timeseries) != len(encoded_ts_arrays):
|
| 140 |
+
raise ValueError(
|
| 141 |
+
f"Mismatch between <ts><ts/> placeholders ({total_ts_cnt}) "
|
| 142 |
+
f"and time series ({len(encoded_ts_arrays)})."
|
| 143 |
+
)
|
| 144 |
+
|
| 145 |
+
if len(encoded_ts_arrays) > 0:
|
| 146 |
+
# Pad time series to the same length
|
| 147 |
+
max_length = max(ts.shape[1] for ts in encoded_ts_arrays)
|
| 148 |
+
padded_ts_arrays = [
|
| 149 |
+
np.pad(ts, ((0, 0), (0, max_length - ts.shape[1]), (0, 0)), mode="constant", constant_values=0.0)
|
| 150 |
+
for ts in encoded_ts_arrays
|
| 151 |
+
]
|
| 152 |
+
concatenated_ts = np.concatenate(padded_ts_arrays, axis=0) # Shape: [batch_size, max_length, feature_dim]
|
| 153 |
+
|
| 154 |
+
# Convert to torch
|
| 155 |
+
concatenated_ts = torch.from_numpy(concatenated_ts).half()
|
| 156 |
+
|
| 157 |
+
# Tokenize the processed prompt
|
| 158 |
+
tokenizer_outputs = {}
|
| 159 |
+
if tokenize and self.tokenizer is not None:
|
| 160 |
+
tokenizer_outputs = self.tokenizer(reconstructed_prompts, padding=padding, padding_side=padding_side, **kwargs)
|
| 161 |
+
else:
|
| 162 |
+
tokenizer_outputs = {"text": reconstructed_prompts}
|
| 163 |
+
|
| 164 |
+
# Create the final output
|
| 165 |
+
outputs = tokenizer_outputs
|
| 166 |
+
if vllm_flag:
|
| 167 |
+
outputs["timeseries"] = zip(ts_tokens, encoded_ts_arrays)
|
| 168 |
+
elif concatenated_ts is not None:
|
| 169 |
+
outputs["timeseries"] = concatenated_ts
|
| 170 |
+
|
| 171 |
+
return BatchFeature(data=outputs)
|
| 172 |
+
|
| 173 |
+
def encode_timeseries(
|
| 174 |
+
self,
|
| 175 |
+
timeseries: Optional[List[List[np.ndarray]]] = None,
|
| 176 |
+
) -> np.ndarray:
|
| 177 |
+
if timeseries is None:
|
| 178 |
+
timeseries = []
|
| 179 |
+
|
| 180 |
+
concatenated_ts = None
|
| 181 |
+
encoded_ts_arrays = []
|
| 182 |
+
|
| 183 |
+
for i, ts in enumerate(timeseries):
|
| 184 |
+
encoded_ts, _, _ = sp_encoding(ts)
|
| 185 |
+
# Ensure time series shape [1, seq_len, feature_dim] for batch concatenation
|
| 186 |
+
encoded_ts_arrays.append(encoded_ts[None, ...])
|
| 187 |
+
|
| 188 |
+
if len(encoded_ts_arrays) > 0:
|
| 189 |
+
# Pad time series to the same length
|
| 190 |
+
max_length = max(ts.shape[1] for ts in encoded_ts_arrays)
|
| 191 |
+
padded_ts_arrays = [
|
| 192 |
+
np.pad(ts, ((0, 0), (0, max_length - ts.shape[1]), (0, 0)), mode="constant", constant_values=0.0)
|
| 193 |
+
for ts in encoded_ts_arrays
|
| 194 |
+
]
|
| 195 |
+
concatenated_ts = np.concatenate(padded_ts_arrays, axis=0) # Shape: [batch_size, max_length, feature_dim]
|
| 196 |
+
|
| 197 |
+
# Convert to torch
|
| 198 |
+
concatenated_ts = torch.from_numpy(concatenated_ts).half()
|
| 199 |
+
|
| 200 |
+
return concatenated_ts
|
| 201 |
+
|
| 202 |
+
@property
|
| 203 |
+
def model_input_names(self):
|
| 204 |
+
"""
|
| 205 |
+
Define the input names expected by the model.
|
| 206 |
+
"""
|
| 207 |
+
tokenizer_input_names = []
|
| 208 |
+
if self.tokenizer and hasattr(self.tokenizer, "model_input_names"):
|
| 209 |
+
tokenizer_input_names = self.tokenizer.model_input_names
|
| 210 |
+
return list(dict.fromkeys(["processed_prompt", "time_series"] + tokenizer_input_names))
|
| 211 |
+
|
| 212 |
+
def batch_decode(self, *args, **kwargs):
|
| 213 |
+
"""
|
| 214 |
+
This method forwards all its arguments to Qwen3TokenizerFast's [`~PreTrainedTokenizer.batch_decode`]. Please
|
| 215 |
+
refer to the docstring of this method for more information.
|
| 216 |
+
"""
|
| 217 |
+
return self.tokenizer.batch_decode(*args, **kwargs)
|
| 218 |
+
|
| 219 |
+
def decode(self, *args, **kwargs):
|
| 220 |
+
"""
|
| 221 |
+
This method forwards all its arguments to Qwen3TokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer to
|
| 222 |
+
the docstring of this method for more information.
|
| 223 |
+
"""
|
| 224 |
+
return self.tokenizer.decode(*args, **kwargs)
|
processor_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoProcessor": "processing_qwen3_ts.Qwen3TSProcessor"
|
| 4 |
+
},
|
| 5 |
+
"processor_class": "Qwen3TSProcessor"
|
| 6 |
+
}
|
pytorch_model-00001-of-00004.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f99f086fd1bf92bd3aab1bb91fee2c840df0af525f8038cae1d7b1b8900480ee
|
| 3 |
+
size 4902281803
|
pytorch_model-00002-of-00004.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b8700532091097ce1c635bfcd6b3c3fe0da628a7d7def61fa16015a72f52a535
|
| 3 |
+
size 4915992380
|
pytorch_model-00003-of-00004.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0fb0a51248089c6b0a05086e5f32497cc14661530afca9aa42c70c1319577cc0
|
| 3 |
+
size 4983100114
|
pytorch_model-00004-of-00004.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b961b2c4237ebfb312192e27bfd3999d3488120fe152a98ad7f1294f179bcfa
|
| 3 |
+
size 1715871460
|
pytorch_model.bin.index.json
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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model-00001-of-00004.bin",
|
| 8 |
+
"model.layers.0.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 9 |
+
"model.layers.0.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 10 |
+
"model.layers.0.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 11 |
+
"model.layers.0.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 12 |
+
"model.layers.0.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 13 |
+
"model.layers.0.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 14 |
+
"model.layers.0.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 15 |
+
"model.layers.0.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 16 |
+
"model.layers.0.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 17 |
+
"model.layers.0.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 18 |
+
"model.layers.0.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 19 |
+
"model.layers.1.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 20 |
+
"model.layers.1.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 21 |
+
"model.layers.1.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 22 |
+
"model.layers.1.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 23 |
+
"model.layers.1.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 24 |
+
"model.layers.1.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 25 |
+
"model.layers.1.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 26 |
+
"model.layers.1.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 27 |
+
"model.layers.1.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 28 |
+
"model.layers.1.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 29 |
+
"model.layers.1.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 30 |
+
"model.layers.10.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 31 |
+
"model.layers.10.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 32 |
+
"model.layers.10.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 33 |
+
"model.layers.10.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 34 |
+
"model.layers.10.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 35 |
+
"model.layers.10.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 36 |
+
"model.layers.10.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 37 |
+
"model.layers.10.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 38 |
+
"model.layers.10.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 39 |
+
"model.layers.10.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 40 |
+
"model.layers.10.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 41 |
+
"model.layers.11.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 42 |
+
"model.layers.11.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 43 |
+
"model.layers.11.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 44 |
+
"model.layers.11.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 45 |
+
"model.layers.11.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 46 |
+
"model.layers.11.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 47 |
+
"model.layers.11.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 48 |
+
"model.layers.11.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 49 |
+
"model.layers.11.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 50 |
+
"model.layers.11.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 51 |
+
"model.layers.11.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 52 |
+
"model.layers.12.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 53 |
+
"model.layers.12.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 54 |
+
"model.layers.12.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 55 |
+
"model.layers.12.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 56 |
+
"model.layers.12.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 57 |
+
"model.layers.12.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 58 |
+
"model.layers.12.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 59 |
+
"model.layers.12.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 60 |
+
"model.layers.12.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 61 |
+
"model.layers.12.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 62 |
+
"model.layers.12.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 63 |
+
"model.layers.13.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 64 |
+
"model.layers.13.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 65 |
+
"model.layers.13.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 66 |
+
"model.layers.13.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 67 |
+
"model.layers.13.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 68 |
+
"model.layers.13.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 69 |
+
"model.layers.13.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 70 |
+
"model.layers.13.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 71 |
+
"model.layers.13.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 72 |
+
"model.layers.13.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 73 |
+
"model.layers.13.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 74 |
+
"model.layers.14.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 75 |
+
"model.layers.14.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 76 |
+
"model.layers.14.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 77 |
+
"model.layers.14.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 78 |
+
"model.layers.14.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 79 |
+
"model.layers.14.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 80 |
+
"model.layers.14.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 81 |
+
"model.layers.14.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 82 |
+
"model.layers.14.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 83 |
+
"model.layers.14.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 84 |
+
"model.layers.14.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 85 |
+
"model.layers.15.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 86 |
+
"model.layers.15.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 87 |
+
"model.layers.15.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 88 |
+
"model.layers.15.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 89 |
+
"model.layers.15.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 90 |
+
"model.layers.15.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 91 |
+
"model.layers.15.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 92 |
+
"model.layers.15.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 93 |
+
"model.layers.15.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 94 |
+
"model.layers.15.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 95 |
+
"model.layers.15.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 96 |
+
"model.layers.16.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 97 |
+
"model.layers.16.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 98 |
+
"model.layers.16.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 99 |
+
"model.layers.16.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 100 |
+
"model.layers.16.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 101 |
+
"model.layers.16.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 102 |
+
"model.layers.16.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 103 |
+
"model.layers.16.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 104 |
+
"model.layers.16.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 105 |
+
"model.layers.16.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 106 |
+
"model.layers.16.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 107 |
+
"model.layers.17.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 108 |
+
"model.layers.17.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 109 |
+
"model.layers.17.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 110 |
+
"model.layers.17.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 111 |
+
"model.layers.17.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 112 |
+
"model.layers.17.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 113 |
+
"model.layers.17.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 114 |
+
"model.layers.17.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 115 |
+
"model.layers.17.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 116 |
+
"model.layers.17.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 117 |
+
"model.layers.17.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 118 |
+
"model.layers.18.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 119 |
+
"model.layers.18.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 120 |
+
"model.layers.18.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 121 |
+
"model.layers.18.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 122 |
+
"model.layers.18.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 123 |
+
"model.layers.18.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 124 |
+
"model.layers.18.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 125 |
+
"model.layers.18.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 126 |
+
"model.layers.18.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 127 |
+
"model.layers.18.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 128 |
+
"model.layers.18.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 129 |
+
"model.layers.19.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 130 |
+
"model.layers.19.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 131 |
+
"model.layers.19.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 132 |
+
"model.layers.19.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 133 |
+
"model.layers.19.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 134 |
+
"model.layers.19.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 135 |
+
"model.layers.19.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 136 |
+
"model.layers.19.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 137 |
+
"model.layers.19.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 138 |
+
"model.layers.19.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 139 |
+
"model.layers.19.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 140 |
+
"model.layers.2.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 141 |
+
"model.layers.2.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 142 |
+
"model.layers.2.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 143 |
+
"model.layers.2.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 144 |
+
"model.layers.2.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 145 |
+
"model.layers.2.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 146 |
+
"model.layers.2.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 147 |
+
"model.layers.2.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 148 |
+
"model.layers.2.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 149 |
+
"model.layers.2.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 150 |
+
"model.layers.2.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 151 |
+
"model.layers.20.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 152 |
+
"model.layers.20.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 153 |
+
"model.layers.20.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 154 |
+
"model.layers.20.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 155 |
+
"model.layers.20.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 156 |
+
"model.layers.20.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 157 |
+
"model.layers.20.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 158 |
+
"model.layers.20.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 159 |
+
"model.layers.20.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 160 |
+
"model.layers.20.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 161 |
+
"model.layers.20.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 162 |
+
"model.layers.21.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 163 |
+
"model.layers.21.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 164 |
+
"model.layers.21.mlp.gate_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 165 |
+
"model.layers.21.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 166 |
+
"model.layers.21.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 167 |
+
"model.layers.21.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 168 |
+
"model.layers.21.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 169 |
+
"model.layers.21.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 170 |
+
"model.layers.21.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 171 |
+
"model.layers.21.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 172 |
+
"model.layers.21.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 173 |
+
"model.layers.22.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 174 |
+
"model.layers.22.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 175 |
+
"model.layers.22.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 176 |
+
"model.layers.22.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 177 |
+
"model.layers.22.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 178 |
+
"model.layers.22.self_attn.k_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 179 |
+
"model.layers.22.self_attn.k_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 180 |
+
"model.layers.22.self_attn.o_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 181 |
+
"model.layers.22.self_attn.q_norm.weight": "pytorch_model-00002-of-00004.bin",
|
| 182 |
+
"model.layers.22.self_attn.q_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 183 |
+
"model.layers.22.self_attn.v_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 184 |
+
"model.layers.23.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 185 |
+
"model.layers.23.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 186 |
+
"model.layers.23.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 187 |
+
"model.layers.23.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 188 |
+
"model.layers.23.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 189 |
+
"model.layers.23.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 190 |
+
"model.layers.23.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 191 |
+
"model.layers.23.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 192 |
+
"model.layers.23.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 193 |
+
"model.layers.23.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 194 |
+
"model.layers.23.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 195 |
+
"model.layers.24.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 196 |
+
"model.layers.24.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 197 |
+
"model.layers.24.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 198 |
+
"model.layers.24.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 199 |
+
"model.layers.24.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 200 |
+
"model.layers.24.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 201 |
+
"model.layers.24.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 202 |
+
"model.layers.24.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 203 |
+
"model.layers.24.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 204 |
+
"model.layers.24.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 205 |
+
"model.layers.24.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 206 |
+
"model.layers.25.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 207 |
+
"model.layers.25.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 208 |
+
"model.layers.25.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 209 |
+
"model.layers.25.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 210 |
+
"model.layers.25.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 211 |
+
"model.layers.25.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 212 |
+
"model.layers.25.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 213 |
+
"model.layers.25.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 214 |
+
"model.layers.25.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 215 |
+
"model.layers.25.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 216 |
+
"model.layers.25.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 217 |
+
"model.layers.26.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 218 |
+
"model.layers.26.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 219 |
+
"model.layers.26.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 220 |
+
"model.layers.26.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 221 |
+
"model.layers.26.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 222 |
+
"model.layers.26.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 223 |
+
"model.layers.26.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 224 |
+
"model.layers.26.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 225 |
+
"model.layers.26.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 226 |
+
"model.layers.26.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 227 |
+
"model.layers.26.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 228 |
+
"model.layers.27.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 229 |
+
"model.layers.27.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 230 |
+
"model.layers.27.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 231 |
+
"model.layers.27.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 232 |
+
"model.layers.27.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 233 |
+
"model.layers.27.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 234 |
+
"model.layers.27.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 235 |
+
"model.layers.27.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 236 |
+
"model.layers.27.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 237 |
+
"model.layers.27.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 238 |
+
"model.layers.27.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 239 |
+
"model.layers.28.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 240 |
+
"model.layers.28.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 241 |
+
"model.layers.28.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 242 |
+
"model.layers.28.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 243 |
+
"model.layers.28.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 244 |
+
"model.layers.28.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 245 |
+
"model.layers.28.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 246 |
+
"model.layers.28.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 247 |
+
"model.layers.28.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 248 |
+
"model.layers.28.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 249 |
+
"model.layers.28.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 250 |
+
"model.layers.29.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 251 |
+
"model.layers.29.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 252 |
+
"model.layers.29.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 253 |
+
"model.layers.29.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 254 |
+
"model.layers.29.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 255 |
+
"model.layers.29.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 256 |
+
"model.layers.29.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 257 |
+
"model.layers.29.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 258 |
+
"model.layers.29.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 259 |
+
"model.layers.29.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 260 |
+
"model.layers.29.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 261 |
+
"model.layers.3.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 262 |
+
"model.layers.3.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 263 |
+
"model.layers.3.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 264 |
+
"model.layers.3.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 265 |
+
"model.layers.3.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 266 |
+
"model.layers.3.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 267 |
+
"model.layers.3.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 268 |
+
"model.layers.3.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 269 |
+
"model.layers.3.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 270 |
+
"model.layers.3.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 271 |
+
"model.layers.3.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 272 |
+
"model.layers.30.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 273 |
+
"model.layers.30.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 274 |
+
"model.layers.30.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 275 |
+
"model.layers.30.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 276 |
+
"model.layers.30.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 277 |
+
"model.layers.30.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 278 |
+
"model.layers.30.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 279 |
+
"model.layers.30.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 280 |
+
"model.layers.30.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 281 |
+
"model.layers.30.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 282 |
+
"model.layers.30.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 283 |
+
"model.layers.31.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 284 |
+
"model.layers.31.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 285 |
+
"model.layers.31.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 286 |
+
"model.layers.31.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 287 |
+
"model.layers.31.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 288 |
+
"model.layers.31.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 289 |
+
"model.layers.31.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 290 |
+
"model.layers.31.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 291 |
+
"model.layers.31.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 292 |
+
"model.layers.31.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 293 |
+
"model.layers.31.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 294 |
+
"model.layers.32.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 295 |
+
"model.layers.32.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 296 |
+
"model.layers.32.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 297 |
+
"model.layers.32.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 298 |
+
"model.layers.32.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 299 |
+
"model.layers.32.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 300 |
+
"model.layers.32.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 301 |
+
"model.layers.32.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 302 |
+
"model.layers.32.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 303 |
+
"model.layers.32.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 304 |
+
"model.layers.32.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 305 |
+
"model.layers.33.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 306 |
+
"model.layers.33.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 307 |
+
"model.layers.33.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 308 |
+
"model.layers.33.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 309 |
+
"model.layers.33.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 310 |
+
"model.layers.33.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 311 |
+
"model.layers.33.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 312 |
+
"model.layers.33.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 313 |
+
"model.layers.33.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 314 |
+
"model.layers.33.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 315 |
+
"model.layers.33.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 316 |
+
"model.layers.34.input_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 317 |
+
"model.layers.34.mlp.down_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 318 |
+
"model.layers.34.mlp.gate_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 319 |
+
"model.layers.34.mlp.up_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 320 |
+
"model.layers.34.post_attention_layernorm.weight": "pytorch_model-00003-of-00004.bin",
|
| 321 |
+
"model.layers.34.self_attn.k_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 322 |
+
"model.layers.34.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 323 |
+
"model.layers.34.self_attn.o_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 324 |
+
"model.layers.34.self_attn.q_norm.weight": "pytorch_model-00003-of-00004.bin",
|
| 325 |
+
"model.layers.34.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 326 |
+
"model.layers.34.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 327 |
+
"model.layers.35.input_layernorm.weight": "pytorch_model-00004-of-00004.bin",
|
| 328 |
+
"model.layers.35.mlp.down_proj.weight": "pytorch_model-00004-of-00004.bin",
|
| 329 |
+
"model.layers.35.mlp.gate_proj.weight": "pytorch_model-00004-of-00004.bin",
|
| 330 |
+
"model.layers.35.mlp.up_proj.weight": "pytorch_model-00004-of-00004.bin",
|
| 331 |
+
"model.layers.35.post_attention_layernorm.weight": "pytorch_model-00004-of-00004.bin",
|
| 332 |
+
"model.layers.35.self_attn.k_norm.weight": "pytorch_model-00004-of-00004.bin",
|
| 333 |
+
"model.layers.35.self_attn.k_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 334 |
+
"model.layers.35.self_attn.o_proj.weight": "pytorch_model-00004-of-00004.bin",
|
| 335 |
+
"model.layers.35.self_attn.q_norm.weight": "pytorch_model-00004-of-00004.bin",
|
| 336 |
+
"model.layers.35.self_attn.q_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 337 |
+
"model.layers.35.self_attn.v_proj.weight": "pytorch_model-00003-of-00004.bin",
|
| 338 |
+
"model.layers.4.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 339 |
+
"model.layers.4.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 340 |
+
"model.layers.4.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 341 |
+
"model.layers.4.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 342 |
+
"model.layers.4.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 343 |
+
"model.layers.4.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 344 |
+
"model.layers.4.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 345 |
+
"model.layers.4.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 346 |
+
"model.layers.4.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 347 |
+
"model.layers.4.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 348 |
+
"model.layers.4.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 349 |
+
"model.layers.5.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 350 |
+
"model.layers.5.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 351 |
+
"model.layers.5.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 352 |
+
"model.layers.5.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 353 |
+
"model.layers.5.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 354 |
+
"model.layers.5.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 355 |
+
"model.layers.5.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 356 |
+
"model.layers.5.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 357 |
+
"model.layers.5.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 358 |
+
"model.layers.5.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 359 |
+
"model.layers.5.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 360 |
+
"model.layers.6.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 361 |
+
"model.layers.6.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 362 |
+
"model.layers.6.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 363 |
+
"model.layers.6.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 364 |
+
"model.layers.6.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 365 |
+
"model.layers.6.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 366 |
+
"model.layers.6.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 367 |
+
"model.layers.6.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 368 |
+
"model.layers.6.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 369 |
+
"model.layers.6.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 370 |
+
"model.layers.6.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 371 |
+
"model.layers.7.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 372 |
+
"model.layers.7.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 373 |
+
"model.layers.7.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 374 |
+
"model.layers.7.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 375 |
+
"model.layers.7.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 376 |
+
"model.layers.7.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 377 |
+
"model.layers.7.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 378 |
+
"model.layers.7.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 379 |
+
"model.layers.7.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 380 |
+
"model.layers.7.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 381 |
+
"model.layers.7.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 382 |
+
"model.layers.8.input_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 383 |
+
"model.layers.8.mlp.down_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 384 |
+
"model.layers.8.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 385 |
+
"model.layers.8.mlp.up_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 386 |
+
"model.layers.8.post_attention_layernorm.weight": "pytorch_model-00001-of-00004.bin",
|
| 387 |
+
"model.layers.8.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 388 |
+
"model.layers.8.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 389 |
+
"model.layers.8.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 390 |
+
"model.layers.8.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 391 |
+
"model.layers.8.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 392 |
+
"model.layers.8.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 393 |
+
"model.layers.9.input_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 394 |
+
"model.layers.9.mlp.down_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 395 |
+
"model.layers.9.mlp.gate_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 396 |
+
"model.layers.9.mlp.up_proj.weight": "pytorch_model-00002-of-00004.bin",
|
| 397 |
+
"model.layers.9.post_attention_layernorm.weight": "pytorch_model-00002-of-00004.bin",
|
| 398 |
+
"model.layers.9.self_attn.k_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 399 |
+
"model.layers.9.self_attn.k_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 400 |
+
"model.layers.9.self_attn.o_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 401 |
+
"model.layers.9.self_attn.q_norm.weight": "pytorch_model-00001-of-00004.bin",
|
| 402 |
+
"model.layers.9.self_attn.q_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 403 |
+
"model.layers.9.self_attn.v_proj.weight": "pytorch_model-00001-of-00004.bin",
|
| 404 |
+
"model.norm.weight": "pytorch_model-00004-of-00004.bin",
|
| 405 |
+
"ts_encoder.mlp.0.bias": "pytorch_model-00004-of-00004.bin",
|
| 406 |
+
"ts_encoder.mlp.0.weight": "pytorch_model-00004-of-00004.bin",
|
| 407 |
+
"ts_encoder.mlp.2.bias": "pytorch_model-00004-of-00004.bin",
|
| 408 |
+
"ts_encoder.mlp.2.weight": "pytorch_model-00004-of-00004.bin",
|
| 409 |
+
"ts_encoder.mlp.4.bias": "pytorch_model-00004-of-00004.bin",
|
| 410 |
+
"ts_encoder.mlp.4.weight": "pytorch_model-00004-of-00004.bin",
|
| 411 |
+
"ts_encoder.mlp.6.bias": "pytorch_model-00004-of-00004.bin",
|
| 412 |
+
"ts_encoder.mlp.6.weight": "pytorch_model-00004-of-00004.bin",
|
| 413 |
+
"ts_encoder.mlp.8.bias": "pytorch_model-00004-of-00004.bin",
|
| 414 |
+
"ts_encoder.mlp.8.weight": "pytorch_model-00004-of-00004.bin",
|
| 415 |
+
"ts_encoder.position_embedding.weight": "pytorch_model-00004-of-00004.bin"
|
| 416 |
+
}
|
| 417 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<ts>",
|
| 4 |
+
"<ts/>"
|
| 5 |
+
],
|
| 6 |
+
"eos_token": {
|
| 7 |
+
"content": "<|im_end|>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false
|
| 12 |
+
},
|
| 13 |
+
"pad_token": {
|
| 14 |
+
"content": "<|endoftext|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false
|
| 19 |
+
}
|
| 20 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f58249c804f02dc95986d90822c6ca889b91cfdd40befa5066ff7d50fce80342
|
| 3 |
+
size 11423017
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"151643": {
|
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151644": {
|
| 14 |
+
"content": "<|im_start|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151645": {
|
| 22 |
+
"content": "<|im_end|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151646": {
|
| 30 |
+
"content": "<|object_ref_start|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151647": {
|
| 38 |
+
"content": "<|object_ref_end|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151648": {
|
| 46 |
+
"content": "<|box_start|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151649": {
|
| 54 |
+
"content": "<|box_end|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151650": {
|
| 62 |
+
"content": "<|quad_start|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151651": {
|
| 70 |
+
"content": "<|quad_end|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151652": {
|
| 78 |
+
"content": "<|vision_start|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151653": {
|
| 86 |
+
"content": "<|vision_end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151654": {
|
| 94 |
+
"content": "<|vision_pad|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151655": {
|
| 102 |
+
"content": "<|image_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151656": {
|
| 110 |
+
"content": "<|video_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151657": {
|
| 118 |
+
"content": "<tool_call>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": false
|
| 124 |
+
},
|
| 125 |
+
"151658": {
|
| 126 |
+
"content": "</tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151659": {
|
| 134 |
+
"content": "<|fim_prefix|>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151660": {
|
| 142 |
+
"content": "<|fim_middle|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151661": {
|
| 150 |
+
"content": "<|fim_suffix|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151662": {
|
| 158 |
+
"content": "<|fim_pad|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151663": {
|
| 166 |
+
"content": "<|repo_name|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151664": {
|
| 174 |
+
"content": "<|file_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
},
|
| 181 |
+
"151665": {
|
| 182 |
+
"content": "<tool_response>",
|
| 183 |
+
"lstrip": false,
|
| 184 |
+
"normalized": false,
|
| 185 |
+
"rstrip": false,
|
| 186 |
+
"single_word": false,
|
| 187 |
+
"special": false
|
| 188 |
+
},
|
| 189 |
+
"151666": {
|
| 190 |
+
"content": "</tool_response>",
|
| 191 |
+
"lstrip": false,
|
| 192 |
+
"normalized": false,
|
| 193 |
+
"rstrip": false,
|
| 194 |
+
"single_word": false,
|
| 195 |
+
"special": false
|
| 196 |
+
},
|
| 197 |
+
"151667": {
|
| 198 |
+
"content": "<think>",
|
| 199 |
+
"lstrip": false,
|
| 200 |
+
"normalized": false,
|
| 201 |
+
"rstrip": false,
|
| 202 |
+
"single_word": false,
|
| 203 |
+
"special": false
|
| 204 |
+
},
|
| 205 |
+
"151668": {
|
| 206 |
+
"content": "</think>",
|
| 207 |
+
"lstrip": false,
|
| 208 |
+
"normalized": false,
|
| 209 |
+
"rstrip": false,
|
| 210 |
+
"single_word": false,
|
| 211 |
+
"special": false
|
| 212 |
+
},
|
| 213 |
+
"151669": {
|
| 214 |
+
"content": "<ts>",
|
| 215 |
+
"lstrip": false,
|
| 216 |
+
"normalized": false,
|
| 217 |
+
"rstrip": false,
|
| 218 |
+
"single_word": false,
|
| 219 |
+
"special": true
|
| 220 |
+
},
|
| 221 |
+
"151670": {
|
| 222 |
+
"content": "<ts/>",
|
| 223 |
+
"lstrip": false,
|
| 224 |
+
"normalized": false,
|
| 225 |
+
"rstrip": false,
|
| 226 |
+
"single_word": false,
|
| 227 |
+
"special": true
|
| 228 |
+
}
|
| 229 |
+
},
|
| 230 |
+
"additional_special_tokens": [
|
| 231 |
+
"<ts>",
|
| 232 |
+
"<ts/>"
|
| 233 |
+
],
|
| 234 |
+
"auto_map": {
|
| 235 |
+
"AutoProcessor": "processing_qwen3_ts.Qwen3TSProcessor"
|
| 236 |
+
},
|
| 237 |
+
"bos_token": null,
|
| 238 |
+
"clean_up_tokenization_spaces": false,
|
| 239 |
+
"eos_token": "<|im_end|>",
|
| 240 |
+
"errors": "replace",
|
| 241 |
+
"extra_special_tokens": {},
|
| 242 |
+
"model_max_length": 131072,
|
| 243 |
+
"pad_token": "<|endoftext|>",
|
| 244 |
+
"padding_side": "right",
|
| 245 |
+
"processor_class": "Qwen3TSProcessor",
|
| 246 |
+
"split_special_tokens": false,
|
| 247 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 248 |
+
"unk_token": null
|
| 249 |
+
}
|
trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2875c51ada563e5aedfdeacfcafff7e1c038724a25627f0d30a0b6b74d6c18bc
|
| 3 |
+
size 7480
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|