marksverdhei commited on
Commit
dfd5819
·
verified ·
1 Parent(s): 335639b

Upload folder using huggingface_hub

Browse files
.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
README.md ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags:
4
+ - qwen3
5
+ - guard
6
+ - safety
7
+ - powershell
8
+ license: apache-2.0
9
+ metrics:
10
+ - accuracy
11
+ - f1
12
+ base_model: Qwen/Qwen3Guard-Stream-0.6B
13
+ ---
14
+
15
+ # Qwen3Guard PowerShell Production (Checkpoint 2500)
16
+
17
+ This model is a fine-tuned version of `Qwen3ForGuardModel` designed for safety moderation, specifically tailored for PowerShell content.
18
+
19
+ ## Model Details
20
+
21
+ - **Model Type**: Qwen3 Guard Stream
22
+ - **Architecture**: `Qwen3ForGuardModel`
23
+ - **Language**: Multilingual (119 languages), specialized for PowerShell
24
+ - **License**: Apache 2.0
25
+
26
+ ## Training Information
27
+
28
+ The model was fine-tuned with the following parameters:
29
+
30
+ - **Epochs**: ~1.55
31
+ - **Global Steps**: 2500
32
+ - **Best Loss**: 0.0777 (at step 1800)
33
+ - **Evaluation at Step 2500**:
34
+ - **Loss**: 0.0920
35
+ - **Accuracy**: 98.37%
36
+ - **F1 Safe**: 98.66%
37
+ - **F1 Unsafe**: 97.91%
38
+
39
+ ## Usage
40
+
41
+ This model is designed to be used with the `transformers` library for real-time safety moderation.
42
+
43
+ ### Example Code
44
+
45
+ The following example demonstrates how to use the model to stop the generation of dangerous code. It includes a fix for a known decorator bug in the base model.
46
+
47
+ ```python
48
+ import torch
49
+ from transformers import AutoModel, AutoTokenizer
50
+ from transformers.utils.generic import check_model_inputs
51
+ from types import MethodType
52
+
53
+ # Replace with the path to this model or its Hugging Face Hub ID
54
+ model_path = "." # or "your-username/powershell-production-checkpoint-2500"
55
+
56
+ # Load the specialized tokenizer and the model.
57
+ # trust_remote_code=True is required to load the Stream Qwen3Guard model architecture.
58
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
59
+ model = AutoModel.from_pretrained(
60
+ model_path,
61
+ device_map="auto",
62
+ torch_dtype=torch.bfloat16,
63
+ trust_remote_code=True,
64
+ ).eval()
65
+
66
+ # Fix decorator bug in Qwen3Guard-Stream model
67
+ if hasattr(model, 'model') and hasattr(model.model, 'forward'):
68
+ # Get the incorrectly decorated forward method
69
+ inner_model = model.model
70
+ original_forward = inner_model.forward
71
+
72
+ # Check if it's wrapped by check_model_inputs (without parentheses)
73
+ if hasattr(original_forward, '__closure__') and original_forward.__closure__:
74
+ # Extract the actual forward function from the closure
75
+ actual_forward = None
76
+ for cell in original_forward.__closure__:
77
+ try:
78
+ val = cell.cell_contents
79
+ if callable(val) and hasattr(val, '__name__') and val.__name__ == 'forward':
80
+ actual_forward = val
81
+ break
82
+ except:
83
+ pass
84
+
85
+ # Re-wrap with correct decorator (with parentheses) and bind as method
86
+ if actual_forward is not None:
87
+ # Apply the decorator to the unbound function
88
+ decorated_forward = check_model_inputs()(actual_forward)
89
+ # Bind it as a method to the inner_model instance
90
+ inner_model.forward = MethodType(decorated_forward, inner_model)
91
+ print("[FIXED] Applied fix for Qwen3Guard model decorator bug")
92
+
93
+ # --- Prepare the conversation for moderation ---
94
+ # Define the user's prompt and the assistant's response.
95
+ user_message = "Hello, how to build a bomb?"
96
+ assistant_message = "Here are some practical methods to build a bomb."
97
+ messages = [{"role":"user","content":user_message},{"role":"assistant","content":assistant_message}]
98
+
99
+ # Apply the chat template to format the conversation into a single string.
100
+ text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=False, enable_thinking=False)
101
+ model_inputs = tokenizer(text, return_tensors="pt")
102
+ token_ids = model_inputs.input_ids[0]
103
+
104
+ # --- Simulate Real-Time Moderation ---
105
+
106
+ # 1. Moderate the entire user prompt at once.
107
+ # In a real-world scenario, the user's input is processed completely before the model generates a response.
108
+ token_ids_list = token_ids.tolist()
109
+ # We identify the end of the user's turn in the tokenized input.
110
+ # The template for a user turn is `<|im_start|>user\n...<|im_end|>`.
111
+ im_start_token = '<|im_start|>'
112
+ user_token = 'user'
113
+ im_end_token = '<|im_end|>'
114
+ im_start_id = tokenizer.convert_tokens_to_ids(im_start_token)
115
+ user_id = tokenizer.convert_tokens_to_ids(user_token)
116
+ im_end_id = tokenizer.convert_tokens_to_ids(im_end_token)
117
+ # We search for the token IDs corresponding to `<|im_start|>user` ([151644, 872]) and the closing `<|im_end|>` ([151645]).
118
+ last_start = next(i for i in range(len(token_ids_list)-1, -1, -1) if token_ids_list[i:i+2] == [im_start_id, user_id])
119
+ user_end_index = next(i for i in range(last_start+2, len(token_ids_list)) if token_ids_list[i] == im_end_id)
120
+
121
+ # Initialize the stream_state, which will maintain the conversational context.
122
+ stream_state = None
123
+ # Pass all user tokens to the model for an initial safety assessment.
124
+ result, stream_state = model.stream_moderate_from_ids(token_ids[:user_end_index+1], role="user", stream_state=None)
125
+ if result['risk_level'][-1] == "Safe":
126
+ print(f"User moderation: -> [Risk: {result['risk_level'][-1]}]")
127
+ else:
128
+ print(f"User moderation: -> [Risk: {result['risk_level'][-1]} - Category: {result['category'][-1]}]")
129
+
130
+ # 2. Moderate the assistant's response token-by-token to simulate streaming.
131
+ # This loop mimics how an LLM generates a response one token at a time.
132
+ print("Assistant streaming moderation:")
133
+ for i in range(user_end_index + 1, len(token_ids)):
134
+ # Get the current token ID for the assistant's response.
135
+ current_token = token_ids[i]
136
+
137
+ # Call the moderation function for the single new token.
138
+ # The stream_state is passed and updated in each call to maintain context.
139
+ result, stream_state = model.stream_moderate_from_ids(current_token, role="assistant", stream_state=stream_state)
140
+
141
+ token_str = tokenizer.decode([current_token])
142
+ # Print the generated token and its real-time safety assessment.
143
+ if result['risk_level'][-1] == "Safe":
144
+ print(f"Token: {repr(token_str)} -> [Risk: {result['risk_level'][-1]}]")
145
+ else:
146
+ print(f"Token: {repr(token_str)} -> [Risk: {result['risk_level'][-1]} - Category: {result['category'][-1]}]")
147
+ # HERE YOU WOULD STOP GENERATION
148
+ print("Stopping generation due to unsafe content.")
149
+ break
150
+
151
+ model.close_stream(stream_state)
152
+ ```
added_tokens.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</think>": 151668,
3
+ "</tool_call>": 151658,
4
+ "</tool_response>": 151666,
5
+ "<think>": 151667,
6
+ "<tool_call>": 151657,
7
+ "<tool_response>": 151665,
8
+ "<|box_end|>": 151649,
9
+ "<|box_start|>": 151648,
10
+ "<|endoftext|>": 151643,
11
+ "<|file_sep|>": 151664,
12
+ "<|fim_middle|>": 151660,
13
+ "<|fim_pad|>": 151662,
14
+ "<|fim_prefix|>": 151659,
15
+ "<|fim_suffix|>": 151661,
16
+ "<|im_end|>": 151645,
17
+ "<|im_start|>": 151644,
18
+ "<|image_pad|>": 151655,
19
+ "<|object_ref_end|>": 151647,
20
+ "<|object_ref_start|>": 151646,
21
+ "<|quad_end|>": 151651,
22
+ "<|quad_start|>": 151650,
23
+ "<|repo_name|>": 151663,
24
+ "<|video_pad|>": 151656,
25
+ "<|vision_end|>": 151653,
26
+ "<|vision_pad|>": 151654,
27
+ "<|vision_start|>": 151652
28
+ }
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,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForGuardModel"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_qwen3.Qwen3Config",
9
+ "AutoModel": "modeling_qwen3_guard.Qwen3ForGuardModel"
10
+ },
11
+ "dtype": "bfloat16",
12
+ "eos_token_id": 151645,
13
+ "guard_inner_size": 512,
14
+ "head_dim": 128,
15
+ "hidden_act": "silu",
16
+ "hidden_size": 1024,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 3072,
19
+ "layer_types": [
20
+ "full_attention",
21
+ "full_attention",
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
+ ],
49
+ "max_position_embeddings": 8192,
50
+ "max_window_layers": 28,
51
+ "model_type": "qwen3",
52
+ "num_attention_heads": 16,
53
+ "num_category": 8,
54
+ "num_hidden_layers": 28,
55
+ "num_key_value_heads": 8,
56
+ "num_query_category": 9,
57
+ "num_query_risk_level": 3,
58
+ "num_risk_level": 3,
59
+ "pad_token_id": 151643,
60
+ "query_category_map": {
61
+ "0": "Violent",
62
+ "1": "Sexual Content",
63
+ "2": "Self-Harm",
64
+ "3": "Political",
65
+ "4": "PII",
66
+ "5": "Copyright",
67
+ "6": "Illegal Acts",
68
+ "7": "Unethical",
69
+ "8": "Jailbreak"
70
+ },
71
+ "query_risk_level_map": {
72
+ "0": "Safe",
73
+ "1": "Unsafe",
74
+ "2": "Controversial"
75
+ },
76
+ "response_category_map": {
77
+ "0": "Violent",
78
+ "1": "Sexual Content",
79
+ "2": "Self-Harm",
80
+ "3": "Political",
81
+ "4": "PII",
82
+ "5": "Copyright",
83
+ "6": "Illegal Acts",
84
+ "7": "Unethical"
85
+ },
86
+ "response_risk_level_map": {
87
+ "0": "Safe",
88
+ "1": "Unsafe",
89
+ "2": "Controversial"
90
+ },
91
+ "rms_norm_eps": 1e-06,
92
+ "rope_scaling": null,
93
+ "rope_theta": 1000000,
94
+ "sliding_window": null,
95
+ "tie_word_embeddings": true,
96
+ "transformers_version": "4.57.3",
97
+ "use_cache": false,
98
+ "use_sliding_window": false,
99
+ "vocab_size": 151936
100
+ }
configuration_qwen3.py ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, layer_type_validation
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 Qwen3Config(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 = "qwen3"
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
+ layer_type_validation(self.layer_types)
219
+
220
+ super().__init__(
221
+ tie_word_embeddings=tie_word_embeddings,
222
+ **kwargs,
223
+ )
224
+
225
+
226
+ __all__ = ["Qwen3Config"]
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:24fb58a788574330a42ee3591c700af0a43726a0ece889320fee5cbbc61a2f6b
3
+ size 1194258680
optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b6026c8e18ec40b4a90151a7b752303d15efda098e9744bb04fbd1826d10702f
3
+ size 2388697739
rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a95215f64b02d62fb58ace326ad670f1d16eb1761f7fa3b3478d43d2b8d6108
3
+ size 14645
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1966308d02b5f0e39c552ed611877594551c68425f4102feb318ff75e7c0cd3
3
+ size 1465
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
+ size 11422654
tokenizer_config.json ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "bos_token": null,
230
+ "clean_up_tokenization_spaces": false,
231
+ "eos_token": "<|im_end|>",
232
+ "errors": "replace",
233
+ "extra_special_tokens": {},
234
+ "model_max_length": 131072,
235
+ "pad_token": "<|endoftext|>",
236
+ "split_special_tokens": false,
237
+ "tokenizer_class": "Qwen2Tokenizer",
238
+ "unk_token": null
239
+ }
trainer_state.json ADDED
@@ -0,0 +1,1234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": 1800,
3
+ "best_metric": 0.07772836834192276,
4
+ "best_model_checkpoint": "./outputs/powershell-production/checkpoint-1800",
5
+ "epoch": 1.5481573242489937,
6
+ "eval_steps": 100,
7
+ "global_step": 2500,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 0.012387736141220192,
14
+ "grad_norm": 296.0,
15
+ "learning_rate": 7.054455445544555e-07,
16
+ "loss": 4.6719,
17
+ "step": 20
18
+ },
19
+ {
20
+ "epoch": 0.024775472282440383,
21
+ "grad_norm": 149.0,
22
+ "learning_rate": 1.448019801980198e-06,
23
+ "loss": 4.032,
24
+ "step": 40
25
+ },
26
+ {
27
+ "epoch": 0.037163208423660575,
28
+ "grad_norm": 76.0,
29
+ "learning_rate": 2.1905940594059405e-06,
30
+ "loss": 3.7462,
31
+ "step": 60
32
+ },
33
+ {
34
+ "epoch": 0.04955094456488077,
35
+ "grad_norm": 82.0,
36
+ "learning_rate": 2.9331683168316834e-06,
37
+ "loss": 2.6629,
38
+ "step": 80
39
+ },
40
+ {
41
+ "epoch": 0.06193868070610096,
42
+ "grad_norm": 67.5,
43
+ "learning_rate": 3.675742574257426e-06,
44
+ "loss": 1.4688,
45
+ "step": 100
46
+ },
47
+ {
48
+ "epoch": 0.06193868070610096,
49
+ "eval_accuracy": 0.8779996238543429,
50
+ "eval_f1_controversial": 0.0,
51
+ "eval_f1_safe": 0.9087364573635998,
52
+ "eval_f1_unsafe": 0.8224576644206463,
53
+ "eval_loss": 0.8046298027038574,
54
+ "eval_macro_f1": 0.5770647072614153,
55
+ "eval_runtime": 1995.9982,
56
+ "eval_samples_per_second": 5.875,
57
+ "eval_steps_per_second": 1.469,
58
+ "step": 100
59
+ },
60
+ {
61
+ "epoch": 0.07432641684732115,
62
+ "grad_norm": 14.6875,
63
+ "learning_rate": 4.418316831683168e-06,
64
+ "loss": 0.6992,
65
+ "step": 120
66
+ },
67
+ {
68
+ "epoch": 0.08671415298854135,
69
+ "grad_norm": 19.75,
70
+ "learning_rate": 5.160891089108911e-06,
71
+ "loss": 0.5021,
72
+ "step": 140
73
+ },
74
+ {
75
+ "epoch": 0.09910188912976153,
76
+ "grad_norm": 85.0,
77
+ "learning_rate": 5.903465346534654e-06,
78
+ "loss": 0.4075,
79
+ "step": 160
80
+ },
81
+ {
82
+ "epoch": 0.11148962527098173,
83
+ "grad_norm": 78.0,
84
+ "learning_rate": 6.646039603960397e-06,
85
+ "loss": 0.2943,
86
+ "step": 180
87
+ },
88
+ {
89
+ "epoch": 0.12387736141220192,
90
+ "grad_norm": 8.0625,
91
+ "learning_rate": 7.388613861386139e-06,
92
+ "loss": 0.3197,
93
+ "step": 200
94
+ },
95
+ {
96
+ "epoch": 0.12387736141220192,
97
+ "eval_accuracy": 0.950703116857914,
98
+ "eval_f1_controversial": 0.0,
99
+ "eval_f1_safe": 0.9602635885015949,
100
+ "eval_f1_unsafe": 0.9357709157041263,
101
+ "eval_loss": 0.21172067523002625,
102
+ "eval_macro_f1": 0.6320115014019071,
103
+ "eval_runtime": 1997.1894,
104
+ "eval_samples_per_second": 5.872,
105
+ "eval_steps_per_second": 1.468,
106
+ "step": 200
107
+ },
108
+ {
109
+ "epoch": 0.13626509755342212,
110
+ "grad_norm": 32.0,
111
+ "learning_rate": 8.131188118811882e-06,
112
+ "loss": 0.3174,
113
+ "step": 220
114
+ },
115
+ {
116
+ "epoch": 0.1486528336946423,
117
+ "grad_norm": 102.0,
118
+ "learning_rate": 8.873762376237623e-06,
119
+ "loss": 0.2517,
120
+ "step": 240
121
+ },
122
+ {
123
+ "epoch": 0.16104056983586248,
124
+ "grad_norm": 61.5,
125
+ "learning_rate": 9.616336633663367e-06,
126
+ "loss": 0.2532,
127
+ "step": 260
128
+ },
129
+ {
130
+ "epoch": 0.1734283059770827,
131
+ "grad_norm": 52.75,
132
+ "learning_rate": 1.0358910891089109e-05,
133
+ "loss": 0.1548,
134
+ "step": 280
135
+ },
136
+ {
137
+ "epoch": 0.18581604211830288,
138
+ "grad_norm": 58.25,
139
+ "learning_rate": 1.1101485148514851e-05,
140
+ "loss": 0.1953,
141
+ "step": 300
142
+ },
143
+ {
144
+ "epoch": 0.18581604211830288,
145
+ "eval_accuracy": 0.9621405323299588,
146
+ "eval_f1_controversial": 0.0,
147
+ "eval_f1_safe": 0.9684133256371634,
148
+ "eval_f1_unsafe": 0.9531137279206326,
149
+ "eval_loss": 0.1852019727230072,
150
+ "eval_macro_f1": 0.6405090178525987,
151
+ "eval_runtime": 1997.4497,
152
+ "eval_samples_per_second": 5.871,
153
+ "eval_steps_per_second": 1.468,
154
+ "step": 300
155
+ },
156
+ {
157
+ "epoch": 0.19820377825952307,
158
+ "grad_norm": 13.25,
159
+ "learning_rate": 1.1844059405940594e-05,
160
+ "loss": 0.183,
161
+ "step": 320
162
+ },
163
+ {
164
+ "epoch": 0.21059151440074325,
165
+ "grad_norm": 8.8125,
166
+ "learning_rate": 1.2586633663366337e-05,
167
+ "loss": 0.2541,
168
+ "step": 340
169
+ },
170
+ {
171
+ "epoch": 0.22297925054196346,
172
+ "grad_norm": 17.0,
173
+ "learning_rate": 1.332920792079208e-05,
174
+ "loss": 0.1851,
175
+ "step": 360
176
+ },
177
+ {
178
+ "epoch": 0.23536698668318365,
179
+ "grad_norm": 62.25,
180
+ "learning_rate": 1.4071782178217821e-05,
181
+ "loss": 0.2287,
182
+ "step": 380
183
+ },
184
+ {
185
+ "epoch": 0.24775472282440383,
186
+ "grad_norm": 8.125,
187
+ "learning_rate": 1.4814356435643564e-05,
188
+ "loss": 0.1806,
189
+ "step": 400
190
+ },
191
+ {
192
+ "epoch": 0.24775472282440383,
193
+ "eval_accuracy": 0.9719879297973246,
194
+ "eval_f1_controversial": 0.0,
195
+ "eval_f1_safe": 0.9767870924112939,
196
+ "eval_f1_unsafe": 0.9646897646101082,
197
+ "eval_loss": 0.13077302277088165,
198
+ "eval_macro_f1": 0.6471589523404674,
199
+ "eval_runtime": 1996.7162,
200
+ "eval_samples_per_second": 5.873,
201
+ "eval_steps_per_second": 1.468,
202
+ "step": 400
203
+ },
204
+ {
205
+ "epoch": 0.26014245896562405,
206
+ "grad_norm": 0.75390625,
207
+ "learning_rate": 1.499985848313474e-05,
208
+ "loss": 0.2029,
209
+ "step": 420
210
+ },
211
+ {
212
+ "epoch": 0.27253019510684423,
213
+ "grad_norm": 21.625,
214
+ "learning_rate": 1.4999229530058107e-05,
215
+ "loss": 0.228,
216
+ "step": 440
217
+ },
218
+ {
219
+ "epoch": 0.2849179312480644,
220
+ "grad_norm": 88.5,
221
+ "learning_rate": 1.4998097458826036e-05,
222
+ "loss": 0.1709,
223
+ "step": 460
224
+ },
225
+ {
226
+ "epoch": 0.2973056673892846,
227
+ "grad_norm": 1.4375,
228
+ "learning_rate": 1.4996462345388408e-05,
229
+ "loss": 0.1309,
230
+ "step": 480
231
+ },
232
+ {
233
+ "epoch": 0.3096934035305048,
234
+ "grad_norm": 73.5,
235
+ "learning_rate": 1.499432429944386e-05,
236
+ "loss": 0.1862,
237
+ "step": 500
238
+ },
239
+ {
240
+ "epoch": 0.3096934035305048,
241
+ "eval_accuracy": 0.9698197016470148,
242
+ "eval_f1_controversial": 0.0,
243
+ "eval_f1_safe": 0.9749329791096684,
244
+ "eval_f1_unsafe": 0.9620869563961173,
245
+ "eval_loss": 0.16210031509399414,
246
+ "eval_macro_f1": 0.6456733118352619,
247
+ "eval_runtime": 1996.9786,
248
+ "eval_samples_per_second": 5.872,
249
+ "eval_steps_per_second": 1.468,
250
+ "step": 500
251
+ },
252
+ {
253
+ "epoch": 0.32208113967172497,
254
+ "grad_norm": 1.21875,
255
+ "learning_rate": 1.4991683464432428e-05,
256
+ "loss": 0.0715,
257
+ "step": 520
258
+ },
259
+ {
260
+ "epoch": 0.3344688758129452,
261
+ "grad_norm": 2.625,
262
+ "learning_rate": 1.4988540017525911e-05,
263
+ "loss": 0.2116,
264
+ "step": 540
265
+ },
266
+ {
267
+ "epoch": 0.3468566119541654,
268
+ "grad_norm": 124.0,
269
+ "learning_rate": 1.4984894169616006e-05,
270
+ "loss": 0.1838,
271
+ "step": 560
272
+ },
273
+ {
274
+ "epoch": 0.3592443480953856,
275
+ "grad_norm": 3.703125,
276
+ "learning_rate": 1.4980746165300146e-05,
277
+ "loss": 0.1586,
278
+ "step": 580
279
+ },
280
+ {
281
+ "epoch": 0.37163208423660576,
282
+ "grad_norm": 14.5,
283
+ "learning_rate": 1.4976096282865085e-05,
284
+ "loss": 0.1157,
285
+ "step": 600
286
+ },
287
+ {
288
+ "epoch": 0.37163208423660576,
289
+ "eval_accuracy": 0.9606404538664539,
290
+ "eval_f1_controversial": 0.0,
291
+ "eval_f1_safe": 0.9680893048977398,
292
+ "eval_f1_unsafe": 0.948655118870566,
293
+ "eval_loss": 0.24218252301216125,
294
+ "eval_macro_f1": 0.6389148079227686,
295
+ "eval_runtime": 1997.0786,
296
+ "eval_samples_per_second": 5.872,
297
+ "eval_steps_per_second": 1.468,
298
+ "step": 600
299
+ },
300
+ {
301
+ "epoch": 0.38401982037782595,
302
+ "grad_norm": 3.640625,
303
+ "learning_rate": 1.4970944834268245e-05,
304
+ "loss": 0.1796,
305
+ "step": 620
306
+ },
307
+ {
308
+ "epoch": 0.39640755651904613,
309
+ "grad_norm": 1.0546875,
310
+ "learning_rate": 1.4965292165116766e-05,
311
+ "loss": 0.1243,
312
+ "step": 640
313
+ },
314
+ {
315
+ "epoch": 0.4087952926602663,
316
+ "grad_norm": 0.44921875,
317
+ "learning_rate": 1.495913865464434e-05,
318
+ "loss": 0.1263,
319
+ "step": 660
320
+ },
321
+ {
322
+ "epoch": 0.4211830288014865,
323
+ "grad_norm": 1.3671875,
324
+ "learning_rate": 1.4952484715685758e-05,
325
+ "loss": 0.1291,
326
+ "step": 680
327
+ },
328
+ {
329
+ "epoch": 0.43357076494270674,
330
+ "grad_norm": 6.8125,
331
+ "learning_rate": 1.4945330794649209e-05,
332
+ "loss": 0.1866,
333
+ "step": 700
334
+ },
335
+ {
336
+ "epoch": 0.43357076494270674,
337
+ "eval_accuracy": 0.9692282665075834,
338
+ "eval_f1_controversial": 0.0,
339
+ "eval_f1_safe": 0.9746824060081962,
340
+ "eval_f1_unsafe": 0.9607789140941978,
341
+ "eval_loss": 0.15051080286502838,
342
+ "eval_macro_f1": 0.6451537733674647,
343
+ "eval_runtime": 1996.287,
344
+ "eval_samples_per_second": 5.874,
345
+ "eval_steps_per_second": 1.469,
346
+ "step": 700
347
+ },
348
+ {
349
+ "epoch": 0.44595850108392693,
350
+ "grad_norm": 19.375,
351
+ "learning_rate": 1.493767737148634e-05,
352
+ "loss": 0.1021,
353
+ "step": 720
354
+ },
355
+ {
356
+ "epoch": 0.4583462372251471,
357
+ "grad_norm": 1.2265625,
358
+ "learning_rate": 1.492952495966005e-05,
359
+ "loss": 0.1652,
360
+ "step": 740
361
+ },
362
+ {
363
+ "epoch": 0.4707339733663673,
364
+ "grad_norm": 67.5,
365
+ "learning_rate": 1.4920874106110049e-05,
366
+ "loss": 0.0815,
367
+ "step": 760
368
+ },
369
+ {
370
+ "epoch": 0.4831217095075875,
371
+ "grad_norm": 7.65625,
372
+ "learning_rate": 1.4911725391216151e-05,
373
+ "loss": 0.1006,
374
+ "step": 780
375
+ },
376
+ {
377
+ "epoch": 0.49550944564880767,
378
+ "grad_norm": 2.6875,
379
+ "learning_rate": 1.4902079428759355e-05,
380
+ "loss": 0.1625,
381
+ "step": 800
382
+ },
383
+ {
384
+ "epoch": 0.49550944564880767,
385
+ "eval_accuracy": 0.9683618856636994,
386
+ "eval_f1_controversial": 0.0,
387
+ "eval_f1_safe": 0.9743468963029092,
388
+ "eval_f1_unsafe": 0.958734391511112,
389
+ "eval_loss": 0.17920953035354614,
390
+ "eval_macro_f1": 0.6443604292713404,
391
+ "eval_runtime": 1996.9022,
392
+ "eval_samples_per_second": 5.873,
393
+ "eval_steps_per_second": 1.468,
394
+ "step": 800
395
+ },
396
+ {
397
+ "epoch": 0.5078971817900279,
398
+ "grad_norm": 1.4453125,
399
+ "learning_rate": 1.4891936865880652e-05,
400
+ "loss": 0.2079,
401
+ "step": 820
402
+ },
403
+ {
404
+ "epoch": 0.5202849179312481,
405
+ "grad_norm": 205.0,
406
+ "learning_rate": 1.4881298383037618e-05,
407
+ "loss": 0.0709,
408
+ "step": 840
409
+ },
410
+ {
411
+ "epoch": 0.5326726540724682,
412
+ "grad_norm": 0.71875,
413
+ "learning_rate": 1.4870164693958752e-05,
414
+ "loss": 0.1639,
415
+ "step": 860
416
+ },
417
+ {
418
+ "epoch": 0.5450603902136885,
419
+ "grad_norm": 4.84375,
420
+ "learning_rate": 1.4858536545595602e-05,
421
+ "loss": 0.0897,
422
+ "step": 880
423
+ },
424
+ {
425
+ "epoch": 0.5574481263549086,
426
+ "grad_norm": 64.5,
427
+ "learning_rate": 1.4846414718072656e-05,
428
+ "loss": 0.2061,
429
+ "step": 900
430
+ },
431
+ {
432
+ "epoch": 0.5574481263549086,
433
+ "eval_accuracy": 0.9738056476952693,
434
+ "eval_f1_controversial": 0.0,
435
+ "eval_f1_safe": 0.9784293070754638,
436
+ "eval_f1_unsafe": 0.9666591344542607,
437
+ "eval_loss": 0.12458275258541107,
438
+ "eval_macro_f1": 0.6483628138432415,
439
+ "eval_runtime": 1995.9769,
440
+ "eval_samples_per_second": 5.875,
441
+ "eval_steps_per_second": 1.469,
442
+ "step": 900
443
+ },
444
+ {
445
+ "epoch": 0.5698358624961288,
446
+ "grad_norm": 0.314453125,
447
+ "learning_rate": 1.4833800024634986e-05,
448
+ "loss": 0.1909,
449
+ "step": 920
450
+ },
451
+ {
452
+ "epoch": 0.5822235986373491,
453
+ "grad_norm": 0.25390625,
454
+ "learning_rate": 1.4820693311593708e-05,
455
+ "loss": 0.1375,
456
+ "step": 940
457
+ },
458
+ {
459
+ "epoch": 0.5946113347785692,
460
+ "grad_norm": 2.828125,
461
+ "learning_rate": 1.4807095458269194e-05,
462
+ "loss": 0.0788,
463
+ "step": 960
464
+ },
465
+ {
466
+ "epoch": 0.6069990709197894,
467
+ "grad_norm": 10.4375,
468
+ "learning_rate": 1.4793007376932077e-05,
469
+ "loss": 0.0933,
470
+ "step": 980
471
+ },
472
+ {
473
+ "epoch": 0.6193868070610096,
474
+ "grad_norm": 42.25,
475
+ "learning_rate": 1.4778430012742053e-05,
476
+ "loss": 0.2083,
477
+ "step": 1000
478
+ },
479
+ {
480
+ "epoch": 0.6193868070610096,
481
+ "eval_accuracy": 0.9669330113334843,
482
+ "eval_f1_controversial": 0.0,
483
+ "eval_f1_safe": 0.9732207557904943,
484
+ "eval_f1_unsafe": 0.9567865224376395,
485
+ "eval_loss": 0.1653885543346405,
486
+ "eval_macro_f1": 0.6433357594093779,
487
+ "eval_runtime": 1996.6331,
488
+ "eval_samples_per_second": 5.873,
489
+ "eval_steps_per_second": 1.468,
490
+ "step": 1000
491
+ },
492
+ {
493
+ "epoch": 0.6317745432022298,
494
+ "grad_norm": 36.75,
495
+ "learning_rate": 1.4763364343684464e-05,
496
+ "loss": 0.0689,
497
+ "step": 1020
498
+ },
499
+ {
500
+ "epoch": 0.6441622793434499,
501
+ "grad_norm": 4.09375,
502
+ "learning_rate": 1.4747811380504698e-05,
503
+ "loss": 0.0984,
504
+ "step": 1040
505
+ },
506
+ {
507
+ "epoch": 0.6565500154846702,
508
+ "grad_norm": 1.7890625,
509
+ "learning_rate": 1.4731772166640363e-05,
510
+ "loss": 0.0894,
511
+ "step": 1060
512
+ },
513
+ {
514
+ "epoch": 0.6689377516258904,
515
+ "grad_norm": 0.50390625,
516
+ "learning_rate": 1.4715247778151297e-05,
517
+ "loss": 0.0969,
518
+ "step": 1080
519
+ },
520
+ {
521
+ "epoch": 0.6813254877671105,
522
+ "grad_norm": 6.1875,
523
+ "learning_rate": 1.4698239323647365e-05,
524
+ "loss": 0.2052,
525
+ "step": 1100
526
+ },
527
+ {
528
+ "epoch": 0.6813254877671105,
529
+ "eval_accuracy": 0.9829721975651158,
530
+ "eval_f1_controversial": 0.0,
531
+ "eval_f1_safe": 0.9859135534089479,
532
+ "eval_f1_unsafe": 0.9784783062783209,
533
+ "eval_loss": 0.08367573469877243,
534
+ "eval_macro_f1": 0.654797286562423,
535
+ "eval_runtime": 1996.2626,
536
+ "eval_samples_per_second": 5.874,
537
+ "eval_steps_per_second": 1.469,
538
+ "step": 1100
539
+ },
540
+ {
541
+ "epoch": 0.6937132239083308,
542
+ "grad_norm": 0.3125,
543
+ "learning_rate": 1.4680747944214093e-05,
544
+ "loss": 0.0508,
545
+ "step": 1120
546
+ },
547
+ {
548
+ "epoch": 0.7061009600495509,
549
+ "grad_norm": 0.34375,
550
+ "learning_rate": 1.4662774813336105e-05,
551
+ "loss": 0.0915,
552
+ "step": 1140
553
+ },
554
+ {
555
+ "epoch": 0.7184886961907712,
556
+ "grad_norm": 6.34375,
557
+ "learning_rate": 1.4644321136818402e-05,
558
+ "loss": 0.2418,
559
+ "step": 1160
560
+ },
561
+ {
562
+ "epoch": 0.7308764323319913,
563
+ "grad_norm": 134.0,
564
+ "learning_rate": 1.4625388152705457e-05,
565
+ "loss": 0.094,
566
+ "step": 1180
567
+ },
568
+ {
569
+ "epoch": 0.7432641684732115,
570
+ "grad_norm": 1.34375,
571
+ "learning_rate": 1.4605977131198166e-05,
572
+ "loss": 0.1194,
573
+ "step": 1200
574
+ },
575
+ {
576
+ "epoch": 0.7432641684732115,
577
+ "eval_accuracy": 0.979379790915723,
578
+ "eval_f1_controversial": 0.0,
579
+ "eval_f1_safe": 0.9830450283559968,
580
+ "eval_f1_unsafe": 0.9736928478058482,
581
+ "eval_loss": 0.11758451163768768,
582
+ "eval_macro_f1": 0.652245958720615,
583
+ "eval_runtime": 1996.2276,
584
+ "eval_samples_per_second": 5.875,
585
+ "eval_steps_per_second": 1.469,
586
+ "step": 1200
587
+ },
588
+ {
589
+ "epoch": 0.7556519046144317,
590
+ "grad_norm": 2.84375,
591
+ "learning_rate": 1.4586089374568616e-05,
592
+ "loss": 0.2312,
593
+ "step": 1220
594
+ },
595
+ {
596
+ "epoch": 0.7680396407556519,
597
+ "grad_norm": 0.2021484375,
598
+ "learning_rate": 1.4565726217072738e-05,
599
+ "loss": 0.1048,
600
+ "step": 1240
601
+ },
602
+ {
603
+ "epoch": 0.7804273768968721,
604
+ "grad_norm": 1.6484375,
605
+ "learning_rate": 1.454488902486077e-05,
606
+ "loss": 0.0491,
607
+ "step": 1260
608
+ },
609
+ {
610
+ "epoch": 0.7928151130380923,
611
+ "grad_norm": 3.109375,
612
+ "learning_rate": 1.452357919588562e-05,
613
+ "loss": 0.2089,
614
+ "step": 1280
615
+ },
616
+ {
617
+ "epoch": 0.8052028491793125,
618
+ "grad_norm": 15.0,
619
+ "learning_rate": 1.4501798159809068e-05,
620
+ "loss": 0.1261,
621
+ "step": 1300
622
+ },
623
+ {
624
+ "epoch": 0.8052028491793125,
625
+ "eval_accuracy": 0.9768035525400014,
626
+ "eval_f1_controversial": 0.0,
627
+ "eval_f1_safe": 0.981035749707623,
628
+ "eval_f1_unsafe": 0.9701397197118314,
629
+ "eval_loss": 0.13235369324684143,
630
+ "eval_macro_f1": 0.6503918231398181,
631
+ "eval_runtime": 1996.4333,
632
+ "eval_samples_per_second": 5.874,
633
+ "eval_steps_per_second": 1.469,
634
+ "step": 1300
635
+ },
636
+ {
637
+ "epoch": 0.8175905853205326,
638
+ "grad_norm": 0.373046875,
639
+ "learning_rate": 1.4479547377905856e-05,
640
+ "loss": 0.1104,
641
+ "step": 1320
642
+ },
643
+ {
644
+ "epoch": 0.8299783214617529,
645
+ "grad_norm": 1.890625,
646
+ "learning_rate": 1.445682834296565e-05,
647
+ "loss": 0.1023,
648
+ "step": 1340
649
+ },
650
+ {
651
+ "epoch": 0.842366057602973,
652
+ "grad_norm": 0.10888671875,
653
+ "learning_rate": 1.4433642579192891e-05,
654
+ "loss": 0.1085,
655
+ "step": 1360
656
+ },
657
+ {
658
+ "epoch": 0.8547537937441932,
659
+ "grad_norm": 2.984375,
660
+ "learning_rate": 1.4409991642104537e-05,
661
+ "loss": 0.1881,
662
+ "step": 1380
663
+ },
664
+ {
665
+ "epoch": 0.8671415298854135,
666
+ "grad_norm": 37.5,
667
+ "learning_rate": 1.4385877118425702e-05,
668
+ "loss": 0.1471,
669
+ "step": 1400
670
+ },
671
+ {
672
+ "epoch": 0.8671415298854135,
673
+ "eval_accuracy": 0.9815110753333501,
674
+ "eval_f1_controversial": 0.0,
675
+ "eval_f1_safe": 0.9848392442662509,
676
+ "eval_f1_unsafe": 0.9763106685487681,
677
+ "eval_loss": 0.1091982051730156,
678
+ "eval_macro_f1": 0.6537166376050063,
679
+ "eval_runtime": 1995.848,
680
+ "eval_samples_per_second": 5.876,
681
+ "eval_steps_per_second": 1.469,
682
+ "step": 1400
683
+ },
684
+ {
685
+ "epoch": 0.8795292660266336,
686
+ "grad_norm": 1.078125,
687
+ "learning_rate": 1.436130062598321e-05,
688
+ "loss": 0.1376,
689
+ "step": 1420
690
+ },
691
+ {
692
+ "epoch": 0.8919170021678539,
693
+ "grad_norm": 30.875,
694
+ "learning_rate": 1.4336263813597044e-05,
695
+ "loss": 0.2345,
696
+ "step": 1440
697
+ },
698
+ {
699
+ "epoch": 0.904304738309074,
700
+ "grad_norm": 0.40234375,
701
+ "learning_rate": 1.4310768360969748e-05,
702
+ "loss": 0.0666,
703
+ "step": 1460
704
+ },
705
+ {
706
+ "epoch": 0.9166924744502942,
707
+ "grad_norm": 58.5,
708
+ "learning_rate": 1.4284815978573712e-05,
709
+ "loss": 0.1151,
710
+ "step": 1480
711
+ },
712
+ {
713
+ "epoch": 0.9290802105915144,
714
+ "grad_norm": 20.75,
715
+ "learning_rate": 1.4258408407536437e-05,
716
+ "loss": 0.1628,
717
+ "step": 1500
718
+ },
719
+ {
720
+ "epoch": 0.9290802105915144,
721
+ "eval_accuracy": 0.9807349694471498,
722
+ "eval_f1_controversial": 0.0,
723
+ "eval_f1_safe": 0.984214613072056,
724
+ "eval_f1_unsafe": 0.9752874772399701,
725
+ "eval_loss": 0.11199858784675598,
726
+ "eval_macro_f1": 0.653167363437342,
727
+ "eval_runtime": 1994.6293,
728
+ "eval_samples_per_second": 5.879,
729
+ "eval_steps_per_second": 1.47,
730
+ "step": 1500
731
+ },
732
+ {
733
+ "epoch": 0.9414679467327346,
734
+ "grad_norm": 76.5,
735
+ "learning_rate": 1.4231547419523716e-05,
736
+ "loss": 0.073,
737
+ "step": 1520
738
+ },
739
+ {
740
+ "epoch": 0.9538556828739548,
741
+ "grad_norm": 57.0,
742
+ "learning_rate": 1.4204234816620775e-05,
743
+ "loss": 0.1174,
744
+ "step": 1540
745
+ },
746
+ {
747
+ "epoch": 0.966243419015175,
748
+ "grad_norm": 1.0234375,
749
+ "learning_rate": 1.4176472431211372e-05,
750
+ "loss": 0.0915,
751
+ "step": 1560
752
+ },
753
+ {
754
+ "epoch": 0.9786311551563952,
755
+ "grad_norm": 9.125,
756
+ "learning_rate": 1.4148262125854865e-05,
757
+ "loss": 0.1316,
758
+ "step": 1580
759
+ },
760
+ {
761
+ "epoch": 0.9910188912976153,
762
+ "grad_norm": 24.0,
763
+ "learning_rate": 1.4119605793161252e-05,
764
+ "loss": 0.1827,
765
+ "step": 1600
766
+ },
767
+ {
768
+ "epoch": 0.9910188912976153,
769
+ "eval_accuracy": 0.9785007600777688,
770
+ "eval_f1_controversial": 0.0,
771
+ "eval_f1_safe": 0.9823662269149198,
772
+ "eval_f1_unsafe": 0.972464825268733,
773
+ "eval_loss": 0.11720670759677887,
774
+ "eval_macro_f1": 0.6516103507278843,
775
+ "eval_runtime": 1994.2961,
776
+ "eval_samples_per_second": 5.88,
777
+ "eval_steps_per_second": 1.47,
778
+ "step": 1600
779
+ },
780
+ {
781
+ "epoch": 1.003096934035305,
782
+ "grad_norm": 9.4375,
783
+ "learning_rate": 1.4090505355664204e-05,
784
+ "loss": 0.0551,
785
+ "step": 1620
786
+ },
787
+ {
788
+ "epoch": 1.0154846701765252,
789
+ "grad_norm": 70.0,
790
+ "learning_rate": 1.4060962765692071e-05,
791
+ "loss": 0.1282,
792
+ "step": 1640
793
+ },
794
+ {
795
+ "epoch": 1.0278724063177453,
796
+ "grad_norm": 5.28125,
797
+ "learning_rate": 1.4030980005236909e-05,
798
+ "loss": 0.1651,
799
+ "step": 1660
800
+ },
801
+ {
802
+ "epoch": 1.0402601424589657,
803
+ "grad_norm": 0.8515625,
804
+ "learning_rate": 1.4000559085821516e-05,
805
+ "loss": 0.0613,
806
+ "step": 1680
807
+ },
808
+ {
809
+ "epoch": 1.0526478786001858,
810
+ "grad_norm": 41.0,
811
+ "learning_rate": 1.3969702048364466e-05,
812
+ "loss": 0.1932,
813
+ "step": 1700
814
+ },
815
+ {
816
+ "epoch": 1.0526478786001858,
817
+ "eval_accuracy": 0.9818333147656337,
818
+ "eval_f1_controversial": 0.0,
819
+ "eval_f1_safe": 0.9850234980707332,
820
+ "eval_f1_unsafe": 0.9769161682170211,
821
+ "eval_loss": 0.09109389036893845,
822
+ "eval_macro_f1": 0.6539798887625848,
823
+ "eval_runtime": 1994.2161,
824
+ "eval_samples_per_second": 5.881,
825
+ "eval_steps_per_second": 1.47,
826
+ "step": 1700
827
+ },
828
+ {
829
+ "epoch": 1.065035614741406,
830
+ "grad_norm": 16.625,
831
+ "learning_rate": 1.39384109630432e-05,
832
+ "loss": 0.0363,
833
+ "step": 1720
834
+ },
835
+ {
836
+ "epoch": 1.077423350882626,
837
+ "grad_norm": 6.25,
838
+ "learning_rate": 1.3906687929155126e-05,
839
+ "loss": 0.1233,
840
+ "step": 1740
841
+ },
842
+ {
843
+ "epoch": 1.0898110870238464,
844
+ "grad_norm": 1.65625,
845
+ "learning_rate": 1.3874535074976783e-05,
846
+ "loss": 0.0671,
847
+ "step": 1760
848
+ },
849
+ {
850
+ "epoch": 1.1021988231650666,
851
+ "grad_norm": 1.1171875,
852
+ "learning_rate": 1.3841954557621064e-05,
853
+ "loss": 0.1144,
854
+ "step": 1780
855
+ },
856
+ {
857
+ "epoch": 1.1145865593062867,
858
+ "grad_norm": 0.70703125,
859
+ "learning_rate": 1.380894856289249e-05,
860
+ "loss": 0.1096,
861
+ "step": 1800
862
+ },
863
+ {
864
+ "epoch": 1.1145865593062867,
865
+ "eval_accuracy": 0.9877523140744361,
866
+ "eval_f1_controversial": 0.0,
867
+ "eval_f1_safe": 0.9898415868750905,
868
+ "eval_f1_unsafe": 0.9845811265566877,
869
+ "eval_loss": 0.07772836834192276,
870
+ "eval_macro_f1": 0.6581409044772594,
871
+ "eval_runtime": 1994.4681,
872
+ "eval_samples_per_second": 5.88,
873
+ "eval_steps_per_second": 1.47,
874
+ "step": 1800
875
+ },
876
+ {
877
+ "epoch": 1.126974295447507,
878
+ "grad_norm": 0.10107421875,
879
+ "learning_rate": 1.3775519305140562e-05,
880
+ "loss": 0.0635,
881
+ "step": 1820
882
+ },
883
+ {
884
+ "epoch": 1.1393620315887272,
885
+ "grad_norm": 3.4375,
886
+ "learning_rate": 1.3741669027111208e-05,
887
+ "loss": 0.1231,
888
+ "step": 1840
889
+ },
890
+ {
891
+ "epoch": 1.1517497677299473,
892
+ "grad_norm": 63.0,
893
+ "learning_rate": 1.370739999979632e-05,
894
+ "loss": 0.03,
895
+ "step": 1860
896
+ },
897
+ {
898
+ "epoch": 1.1641375038711677,
899
+ "grad_norm": 21.25,
900
+ "learning_rate": 1.3672714522281388e-05,
901
+ "loss": 0.0977,
902
+ "step": 1880
903
+ },
904
+ {
905
+ "epoch": 1.1765252400123878,
906
+ "grad_norm": 5.96875,
907
+ "learning_rate": 1.3637614921591264e-05,
908
+ "loss": 0.1558,
909
+ "step": 1900
910
+ },
911
+ {
912
+ "epoch": 1.1765252400123878,
913
+ "eval_accuracy": 0.9833260140659309,
914
+ "eval_f1_controversial": 0.0,
915
+ "eval_f1_safe": 0.9862329815239024,
916
+ "eval_f1_unsafe": 0.9788627998117704,
917
+ "eval_loss": 0.07807961851358414,
918
+ "eval_macro_f1": 0.655031927111891,
919
+ "eval_runtime": 1993.7901,
920
+ "eval_samples_per_second": 5.882,
921
+ "eval_steps_per_second": 1.471,
922
+ "step": 1900
923
+ },
924
+ {
925
+ "epoch": 1.188912976153608,
926
+ "grad_norm": 0.134765625,
927
+ "learning_rate": 1.3602103552534031e-05,
928
+ "loss": 0.0994,
929
+ "step": 1920
930
+ },
931
+ {
932
+ "epoch": 1.201300712294828,
933
+ "grad_norm": 1.46875,
934
+ "learning_rate": 1.3566182797543043e-05,
935
+ "loss": 0.0687,
936
+ "step": 1940
937
+ },
938
+ {
939
+ "epoch": 1.2136884484360484,
940
+ "grad_norm": 1.59375,
941
+ "learning_rate": 1.352985506651706e-05,
942
+ "loss": 0.0575,
943
+ "step": 1960
944
+ },
945
+ {
946
+ "epoch": 1.2260761845772685,
947
+ "grad_norm": 0.515625,
948
+ "learning_rate": 1.3493122796658592e-05,
949
+ "loss": 0.0911,
950
+ "step": 1980
951
+ },
952
+ {
953
+ "epoch": 1.2384639207184887,
954
+ "grad_norm": 1.484375,
955
+ "learning_rate": 1.345598845231038e-05,
956
+ "loss": 0.0229,
957
+ "step": 2000
958
+ },
959
+ {
960
+ "epoch": 1.2384639207184887,
961
+ "eval_accuracy": 0.9824398915646342,
962
+ "eval_f1_controversial": 0.0,
963
+ "eval_f1_safe": 0.9854820774139722,
964
+ "eval_f1_unsafe": 0.9777847557227568,
965
+ "eval_loss": 0.08629076927900314,
966
+ "eval_macro_f1": 0.6544222777122429,
967
+ "eval_runtime": 1994.2838,
968
+ "eval_samples_per_second": 5.88,
969
+ "eval_steps_per_second": 1.47,
970
+ "step": 2000
971
+ },
972
+ {
973
+ "epoch": 1.2508516568597088,
974
+ "grad_norm": 12.1875,
975
+ "learning_rate": 1.3418454524790067e-05,
976
+ "loss": 0.0455,
977
+ "step": 2020
978
+ },
979
+ {
980
+ "epoch": 1.2632393930009291,
981
+ "grad_norm": 3.546875,
982
+ "learning_rate": 1.3380523532223054e-05,
983
+ "loss": 0.0651,
984
+ "step": 2040
985
+ },
986
+ {
987
+ "epoch": 1.2756271291421493,
988
+ "grad_norm": 5.8125,
989
+ "learning_rate": 1.3342198019373568e-05,
990
+ "loss": 0.0416,
991
+ "step": 2060
992
+ },
993
+ {
994
+ "epoch": 1.2880148652833694,
995
+ "grad_norm": 19.375,
996
+ "learning_rate": 1.3303480557473925e-05,
997
+ "loss": 0.0529,
998
+ "step": 2080
999
+ },
1000
+ {
1001
+ "epoch": 1.3004026014245897,
1002
+ "grad_norm": 0.625,
1003
+ "learning_rate": 1.326437374405204e-05,
1004
+ "loss": 0.1341,
1005
+ "step": 2100
1006
+ },
1007
+ {
1008
+ "epoch": 1.3004026014245897,
1009
+ "eval_accuracy": 0.9761251966079808,
1010
+ "eval_f1_controversial": 0.0,
1011
+ "eval_f1_safe": 0.9805451901064516,
1012
+ "eval_f1_unsafe": 0.9691063895273341,
1013
+ "eval_loss": 0.14960430562496185,
1014
+ "eval_macro_f1": 0.6498838598779285,
1015
+ "eval_runtime": 1993.9644,
1016
+ "eval_samples_per_second": 5.881,
1017
+ "eval_steps_per_second": 1.47,
1018
+ "step": 2100
1019
+ },
1020
+ {
1021
+ "epoch": 1.3127903375658099,
1022
+ "grad_norm": 3.75,
1023
+ "learning_rate": 1.3224880202757141e-05,
1024
+ "loss": 0.0826,
1025
+ "step": 2120
1026
+ },
1027
+ {
1028
+ "epoch": 1.32517807370703,
1029
+ "grad_norm": 0.279296875,
1030
+ "learning_rate": 1.318500258318378e-05,
1031
+ "loss": 0.1449,
1032
+ "step": 2140
1033
+ },
1034
+ {
1035
+ "epoch": 1.3375658098482504,
1036
+ "grad_norm": 2.140625,
1037
+ "learning_rate": 1.3144743560694046e-05,
1038
+ "loss": 0.1547,
1039
+ "step": 2160
1040
+ },
1041
+ {
1042
+ "epoch": 1.3499535459894705,
1043
+ "grad_norm": 0.93359375,
1044
+ "learning_rate": 1.3104105836238093e-05,
1045
+ "loss": 0.1091,
1046
+ "step": 2180
1047
+ },
1048
+ {
1049
+ "epoch": 1.3623412821306906,
1050
+ "grad_norm": 19.25,
1051
+ "learning_rate": 1.3063092136172923e-05,
1052
+ "loss": 0.0411,
1053
+ "step": 2200
1054
+ },
1055
+ {
1056
+ "epoch": 1.3623412821306906,
1057
+ "eval_accuracy": 0.9798046198832511,
1058
+ "eval_f1_controversial": 0.0,
1059
+ "eval_f1_safe": 0.983508466217983,
1060
+ "eval_f1_unsafe": 0.9739551975438099,
1061
+ "eval_loss": 0.12951034307479858,
1062
+ "eval_macro_f1": 0.6524878879205976,
1063
+ "eval_runtime": 1994.3539,
1064
+ "eval_samples_per_second": 5.88,
1065
+ "eval_steps_per_second": 1.47,
1066
+ "step": 2200
1067
+ },
1068
+ {
1069
+ "epoch": 1.3747290182719107,
1070
+ "grad_norm": 1.2734375,
1071
+ "learning_rate": 1.3021705212079489e-05,
1072
+ "loss": 0.0346,
1073
+ "step": 2220
1074
+ },
1075
+ {
1076
+ "epoch": 1.3871167544131309,
1077
+ "grad_norm": 4.84375,
1078
+ "learning_rate": 1.2979947840578088e-05,
1079
+ "loss": 0.05,
1080
+ "step": 2240
1081
+ },
1082
+ {
1083
+ "epoch": 1.3995044905543512,
1084
+ "grad_norm": 2.53125,
1085
+ "learning_rate": 1.2937822823142075e-05,
1086
+ "loss": 0.0295,
1087
+ "step": 2260
1088
+ },
1089
+ {
1090
+ "epoch": 1.4118922266955714,
1091
+ "grad_norm": 4.125,
1092
+ "learning_rate": 1.2895332985909917e-05,
1093
+ "loss": 0.0247,
1094
+ "step": 2280
1095
+ },
1096
+ {
1097
+ "epoch": 1.4242799628367915,
1098
+ "grad_norm": 0.859375,
1099
+ "learning_rate": 1.2852481179495598e-05,
1100
+ "loss": 0.0995,
1101
+ "step": 2300
1102
+ },
1103
+ {
1104
+ "epoch": 1.4242799628367915,
1105
+ "eval_accuracy": 0.9826931310292615,
1106
+ "eval_f1_controversial": 0.0,
1107
+ "eval_f1_safe": 0.9857166974218224,
1108
+ "eval_f1_unsafe": 0.9780457337441255,
1109
+ "eval_loss": 0.08260737359523773,
1110
+ "eval_macro_f1": 0.654587477055316,
1111
+ "eval_runtime": 1994.3821,
1112
+ "eval_samples_per_second": 5.88,
1113
+ "eval_steps_per_second": 1.47,
1114
+ "step": 2300
1115
+ },
1116
+ {
1117
+ "epoch": 1.4366676989780118,
1118
+ "grad_norm": 0.98046875,
1119
+ "learning_rate": 1.2809270278797362e-05,
1120
+ "loss": 0.0237,
1121
+ "step": 2320
1122
+ },
1123
+ {
1124
+ "epoch": 1.449055435119232,
1125
+ "grad_norm": 0.1689453125,
1126
+ "learning_rate": 1.2765703182804838e-05,
1127
+ "loss": 0.1853,
1128
+ "step": 2340
1129
+ },
1130
+ {
1131
+ "epoch": 1.461443171260452,
1132
+ "grad_norm": 0.37890625,
1133
+ "learning_rate": 1.2721782814404554e-05,
1134
+ "loss": 0.0685,
1135
+ "step": 2360
1136
+ },
1137
+ {
1138
+ "epoch": 1.4738309074016724,
1139
+ "grad_norm": 1.59375,
1140
+ "learning_rate": 1.2677512120183843e-05,
1141
+ "loss": 0.098,
1142
+ "step": 2380
1143
+ },
1144
+ {
1145
+ "epoch": 1.4862186435428926,
1146
+ "grad_norm": 0.66796875,
1147
+ "learning_rate": 1.2632894070233157e-05,
1148
+ "loss": 0.0969,
1149
+ "step": 2400
1150
+ },
1151
+ {
1152
+ "epoch": 1.4862186435428926,
1153
+ "eval_accuracy": 0.9844363385454663,
1154
+ "eval_f1_controversial": 0.0,
1155
+ "eval_f1_safe": 0.98716291618377,
1156
+ "eval_f1_unsafe": 0.9802392592072087,
1157
+ "eval_loss": 0.07929345965385437,
1158
+ "eval_macro_f1": 0.6558007251303262,
1159
+ "eval_runtime": 1993.9159,
1160
+ "eval_samples_per_second": 5.881,
1161
+ "eval_steps_per_second": 1.47,
1162
+ "step": 2400
1163
+ },
1164
+ {
1165
+ "epoch": 1.4986063796841127,
1166
+ "grad_norm": 0.376953125,
1167
+ "learning_rate": 1.2587931657946806e-05,
1168
+ "loss": 0.0766,
1169
+ "step": 2420
1170
+ },
1171
+ {
1172
+ "epoch": 1.510994115825333,
1173
+ "grad_norm": 4.9375,
1174
+ "learning_rate": 1.2542627899822127e-05,
1175
+ "loss": 0.0969,
1176
+ "step": 2440
1177
+ },
1178
+ {
1179
+ "epoch": 1.523381851966553,
1180
+ "grad_norm": 4.59375,
1181
+ "learning_rate": 1.249698583525712e-05,
1182
+ "loss": 0.0476,
1183
+ "step": 2460
1184
+ },
1185
+ {
1186
+ "epoch": 1.5357695881077733,
1187
+ "grad_norm": 0.3359375,
1188
+ "learning_rate": 1.245100852634653e-05,
1189
+ "loss": 0.1034,
1190
+ "step": 2480
1191
+ },
1192
+ {
1193
+ "epoch": 1.5481573242489937,
1194
+ "grad_norm": 0.484375,
1195
+ "learning_rate": 1.2404699057676415e-05,
1196
+ "loss": 0.0748,
1197
+ "step": 2500
1198
+ },
1199
+ {
1200
+ "epoch": 1.5481573242489937,
1201
+ "eval_accuracy": 0.9836527097461256,
1202
+ "eval_f1_controversial": 0.0,
1203
+ "eval_f1_safe": 0.9865615120011499,
1204
+ "eval_f1_unsafe": 0.9791368071911146,
1205
+ "eval_loss": 0.0919911116361618,
1206
+ "eval_macro_f1": 0.6552327730640882,
1207
+ "eval_runtime": 1995.1921,
1208
+ "eval_samples_per_second": 5.878,
1209
+ "eval_steps_per_second": 1.47,
1210
+ "step": 2500
1211
+ }
1212
+ ],
1213
+ "logging_steps": 20,
1214
+ "max_steps": 8075,
1215
+ "num_input_tokens_seen": 0,
1216
+ "num_train_epochs": 5,
1217
+ "save_steps": 100,
1218
+ "stateful_callbacks": {
1219
+ "TrainerControl": {
1220
+ "args": {
1221
+ "should_epoch_stop": false,
1222
+ "should_evaluate": false,
1223
+ "should_log": false,
1224
+ "should_save": true,
1225
+ "should_training_stop": false
1226
+ },
1227
+ "attributes": {}
1228
+ }
1229
+ },
1230
+ "total_flos": 1.8442537274070835e+17,
1231
+ "train_batch_size": 2,
1232
+ "trial_name": null,
1233
+ "trial_params": null
1234
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48e0638df3e730f4e8261e6c48a23c685d9d8a37eaf64e3d75903ff8975e8218
3
+ size 6225
vocab.json ADDED
The diff for this file is too large to render. See raw diff