Model save
Browse files- README.md +79 -0
- all_results.json +21 -0
- configuration_stablelm_epoch.py +117 -0
- eval_results.json +16 -0
- generation_config.json +6 -0
- model.safetensors +1 -1
- modeling_stablelm_epoch.py +919 -0
- runs/Feb19_23-08-06_cccxc542/events.out.tfevents.1708402191.cccxc542.93482.0 +2 -2
- runs/Feb19_23-08-06_cccxc542/events.out.tfevents.1708406899.cccxc542.93482.1 +3 -0
- train_results.json +8 -0
- trainer_state.json +1220 -0
README.md
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
base_model: stabilityai/stablelm-2-zephyr-1_6b
|
4 |
+
tags:
|
5 |
+
- trl
|
6 |
+
- dpo
|
7 |
+
- generated_from_trainer
|
8 |
+
model-index:
|
9 |
+
- name: slm-2-dpo-full
|
10 |
+
results: []
|
11 |
+
---
|
12 |
+
|
13 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
14 |
+
should probably proofread and complete it, then remove this comment. -->
|
15 |
+
|
16 |
+
# slm-2-dpo-full
|
17 |
+
|
18 |
+
This model is a fine-tuned version of [stabilityai/stablelm-2-zephyr-1_6b](https://huggingface.co/stabilityai/stablelm-2-zephyr-1_6b) on the None dataset.
|
19 |
+
It achieves the following results on the evaluation set:
|
20 |
+
- Loss: 31.9894
|
21 |
+
- Rewards/chosen: 0.0244
|
22 |
+
- Rewards/rejected: 0.0188
|
23 |
+
- Rewards/accuracies: 0.5234
|
24 |
+
- Rewards/margins: 0.0057
|
25 |
+
- Logps/rejected: -2491.7576
|
26 |
+
- Logps/chosen: -2806.6704
|
27 |
+
- Logits/rejected: -1.6239
|
28 |
+
- Logits/chosen: -1.6845
|
29 |
+
|
30 |
+
## Model description
|
31 |
+
|
32 |
+
More information needed
|
33 |
+
|
34 |
+
## Intended uses & limitations
|
35 |
+
|
36 |
+
More information needed
|
37 |
+
|
38 |
+
## Training and evaluation data
|
39 |
+
|
40 |
+
More information needed
|
41 |
+
|
42 |
+
## Training procedure
|
43 |
+
|
44 |
+
### Training hyperparameters
|
45 |
+
|
46 |
+
The following hyperparameters were used during training:
|
47 |
+
- learning_rate: 5e-07
|
48 |
+
- train_batch_size: 5
|
49 |
+
- eval_batch_size: 8
|
50 |
+
- seed: 42
|
51 |
+
- distributed_type: multi-GPU
|
52 |
+
- num_devices: 8
|
53 |
+
- gradient_accumulation_steps: 2
|
54 |
+
- total_train_batch_size: 80
|
55 |
+
- total_eval_batch_size: 64
|
56 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
57 |
+
- lr_scheduler_type: cosine
|
58 |
+
- lr_scheduler_warmup_ratio: 0.1
|
59 |
+
- num_epochs: 1
|
60 |
+
|
61 |
+
### Training results
|
62 |
+
|
63 |
+
| Training Loss | Epoch | Step | Validation Loss | Rewards/chosen | Rewards/rejected | Rewards/accuracies | Rewards/margins | Logps/rejected | Logps/chosen | Logits/rejected | Logits/chosen |
|
64 |
+
|:-------------:|:-----:|:----:|:---------------:|:--------------:|:----------------:|:------------------:|:---------------:|:--------------:|:------------:|:---------------:|:-------------:|
|
65 |
+
| 16.8403 | 0.13 | 100 | 19.5118 | 0.0256 | 0.0173 | 0.5273 | 0.0082 | -2491.9011 | -2806.5552 | -1.6068 | -1.6730 |
|
66 |
+
| 28.1241 | 0.26 | 200 | 32.5175 | 0.0085 | -0.0039 | 0.5234 | 0.0124 | -2494.0195 | -2808.2581 | -1.6183 | -1.6812 |
|
67 |
+
| 84.7591 | 0.39 | 300 | 47.8043 | 0.0297 | 0.0136 | 0.5391 | 0.0161 | -2492.2703 | -2806.1406 | -1.5968 | -1.6601 |
|
68 |
+
| 40.7835 | 0.52 | 400 | 30.6722 | 0.0168 | -0.0029 | 0.5547 | 0.0197 | -2493.9204 | -2807.4263 | -1.6288 | -1.6917 |
|
69 |
+
| 36.2204 | 0.65 | 500 | 31.2202 | 0.0303 | 0.0209 | 0.5352 | 0.0095 | -2491.5447 | -2806.0762 | -1.6236 | -1.6843 |
|
70 |
+
| 99.7738 | 0.78 | 600 | 33.7403 | 0.0476 | 0.0372 | 0.5391 | 0.0104 | -2489.9089 | -2804.3484 | -1.6222 | -1.6827 |
|
71 |
+
| 41.8506 | 0.92 | 700 | 32.9133 | 0.0301 | 0.0195 | 0.5547 | 0.0106 | -2491.6851 | -2806.1006 | -1.6211 | -1.6823 |
|
72 |
+
|
73 |
+
|
74 |
+
### Framework versions
|
75 |
+
|
76 |
+
- Transformers 4.36.2
|
77 |
+
- Pytorch 2.2.0+cu118
|
78 |
+
- Datasets 2.14.6
|
79 |
+
- Tokenizers 0.15.2
|
all_results.json
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"epoch": 1.0,
|
3 |
+
"eval_logits/chosen": -1.684511661529541,
|
4 |
+
"eval_logits/rejected": -1.6239439249038696,
|
5 |
+
"eval_logps/chosen": -2806.67041015625,
|
6 |
+
"eval_logps/rejected": -2491.757568359375,
|
7 |
+
"eval_loss": 31.98944854736328,
|
8 |
+
"eval_rewards/accuracies": 0.5234375,
|
9 |
+
"eval_rewards/chosen": 0.024405580013990402,
|
10 |
+
"eval_rewards/margins": 0.0056530386209487915,
|
11 |
+
"eval_rewards/rejected": 0.01875254511833191,
|
12 |
+
"eval_runtime": 110.5807,
|
13 |
+
"eval_samples": 2000,
|
14 |
+
"eval_samples_per_second": 18.086,
|
15 |
+
"eval_steps_per_second": 0.289,
|
16 |
+
"train_loss": 46.613421885577296,
|
17 |
+
"train_runtime": 4597.6924,
|
18 |
+
"train_samples": 61135,
|
19 |
+
"train_samples_per_second": 13.297,
|
20 |
+
"train_steps_per_second": 0.166
|
21 |
+
}
|
configuration_stablelm_epoch.py
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2023 Stability 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 |
+
""" StableLM Epoch model configuration"""
|
15 |
+
from transformers import PretrainedConfig
|
16 |
+
from transformers.utils import logging
|
17 |
+
|
18 |
+
|
19 |
+
logger = logging.get_logger(__name__)
|
20 |
+
|
21 |
+
|
22 |
+
class StableLMEpochConfig(PretrainedConfig):
|
23 |
+
r"""
|
24 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
25 |
+
documentation from [`PretrainedConfig`] for more information.
|
26 |
+
|
27 |
+
Args:
|
28 |
+
vocab_size (`int`, *optional*, defaults to 50_304):
|
29 |
+
Vocabulary size of the StableLM model. Defines the number of different tokens that
|
30 |
+
can be represented by the `inputs_ids` passed when calling [`StableLMEpochModel`].
|
31 |
+
intermediate_size (`int`, *optional*, defaults to 6912):
|
32 |
+
Dimension of the MLP representations.
|
33 |
+
hidden_size (`int`, *optional*, defaults to 2560):
|
34 |
+
Dimension of the decoder layers and the pooler layer.
|
35 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
36 |
+
Number of hidden layers in the Transformer decoder.
|
37 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
38 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
39 |
+
num_key_value_heads (`int`, *optional*):
|
40 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
41 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
42 |
+
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
43 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
44 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
45 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
|
46 |
+
`num_attention_heads`.
|
47 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
48 |
+
The non-linear activation function (function or string).
|
49 |
+
rope_pct (`float`, *optional*, defaults to 1.0):
|
50 |
+
Percentage of hidden dimensions to allocate to rotary embeddings.
|
51 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
52 |
+
The base period of the RoPE embeddings.
|
53 |
+
max_position_embeddings (`int`, *optional*, defaults to 2048):
|
54 |
+
The maximum sequence length that this model might ever be used with.
|
55 |
+
Typically set this to something large just in case (e.g., 512 or 1024 or 2048).
|
56 |
+
initializer_range (`float`, *optional*, defaults to 1e-5):
|
57 |
+
The standard deviation of the truncated_normal_initializer for initializing
|
58 |
+
all weight matrices.
|
59 |
+
norm_eps (`float`, *optional*, defaults to 1e-8):
|
60 |
+
The epsilon used by the normalization layers.
|
61 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
62 |
+
Whether or not the model should return the last key/values attentions
|
63 |
+
(not used by all models). Only relevant if `config.is_decoder=True`.
|
64 |
+
use_qkv_bias (`bool`, *optional*, defaults to `True`):
|
65 |
+
Whether or not the model should use bias for qkv layers.
|
66 |
+
tie_word_embeddings(`bool`, *optional*, defaults to `False`):
|
67 |
+
Whether to tie weight embeddings
|
68 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
69 |
+
The dropout ratio for the attention probabilities.
|
70 |
+
"""
|
71 |
+
model_type = "stablelm_epoch"
|
72 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
73 |
+
|
74 |
+
def __init__(
|
75 |
+
self,
|
76 |
+
vocab_size=50_304,
|
77 |
+
intermediate_size=6912,
|
78 |
+
hidden_size=2560,
|
79 |
+
num_hidden_layers=32,
|
80 |
+
num_attention_heads=32,
|
81 |
+
num_key_value_heads=32,
|
82 |
+
hidden_act="silu",
|
83 |
+
rope_pct=0.25,
|
84 |
+
rope_theta=10_000,
|
85 |
+
max_position_embeddings=4096,
|
86 |
+
initializer_range=0.02,
|
87 |
+
norm_eps=1.0e-5,
|
88 |
+
use_cache=True,
|
89 |
+
use_qkv_bias=True,
|
90 |
+
bos_token_id=0,
|
91 |
+
eos_token_id=2,
|
92 |
+
tie_word_embeddings=False,
|
93 |
+
attention_dropout: float = 0.0,
|
94 |
+
**kwargs,
|
95 |
+
):
|
96 |
+
self.vocab_size = vocab_size
|
97 |
+
self.max_position_embeddings = max_position_embeddings
|
98 |
+
self.intermediate_size = intermediate_size
|
99 |
+
self.hidden_size = hidden_size
|
100 |
+
self.num_hidden_layers = num_hidden_layers
|
101 |
+
self.num_attention_heads = num_attention_heads
|
102 |
+
self.num_key_value_heads = num_key_value_heads
|
103 |
+
self.hidden_act = hidden_act
|
104 |
+
self.rope_pct = rope_pct
|
105 |
+
self.rope_theta = rope_theta
|
106 |
+
self.initializer_range = initializer_range
|
107 |
+
self.norm_eps = norm_eps
|
108 |
+
self.use_cache = use_cache
|
109 |
+
self.use_qkv_bias = use_qkv_bias
|
110 |
+
self.tie_word_embeddings = tie_word_embeddings
|
111 |
+
self.attention_dropout = attention_dropout
|
112 |
+
super().__init__(
|
113 |
+
bos_token_id=bos_token_id,
|
114 |
+
eos_token_id=eos_token_id,
|
115 |
+
tie_word_embeddings=tie_word_embeddings,
|
116 |
+
**kwargs,
|
117 |
+
)
|
eval_results.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"epoch": 1.0,
|
3 |
+
"eval_logits/chosen": -1.684511661529541,
|
4 |
+
"eval_logits/rejected": -1.6239439249038696,
|
5 |
+
"eval_logps/chosen": -2806.67041015625,
|
6 |
+
"eval_logps/rejected": -2491.757568359375,
|
7 |
+
"eval_loss": 31.98944854736328,
|
8 |
+
"eval_rewards/accuracies": 0.5234375,
|
9 |
+
"eval_rewards/chosen": 0.024405580013990402,
|
10 |
+
"eval_rewards/margins": 0.0056530386209487915,
|
11 |
+
"eval_rewards/rejected": 0.01875254511833191,
|
12 |
+
"eval_runtime": 110.5807,
|
13 |
+
"eval_samples": 2000,
|
14 |
+
"eval_samples_per_second": 18.086,
|
15 |
+
"eval_steps_per_second": 0.289
|
16 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 100257,
|
4 |
+
"eos_token_id": 100257,
|
5 |
+
"transformers_version": "4.36.2"
|
6 |
+
}
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 3289069520
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:699753fbaa57b9da7029d3c4177187bad5eefe713a604dc0f9e0a2e5757ffe81
|
3 |
size 3289069520
|
modeling_stablelm_epoch.py
ADDED
@@ -0,0 +1,919 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2023 Stability AI, EleutherAI, 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 |
+
#
|
16 |
+
# This code is based off the following work:
|
17 |
+
# https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/modeling_llama.py
|
18 |
+
# https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_neox/modeling_gpt_neox.py
|
19 |
+
""" PyTorch StableLM Epoch model. """
|
20 |
+
from typing import Optional, Tuple, Union
|
21 |
+
import math
|
22 |
+
import warnings
|
23 |
+
|
24 |
+
import torch
|
25 |
+
import torch.nn.functional as F
|
26 |
+
import torch.utils.checkpoint
|
27 |
+
from torch import nn
|
28 |
+
from torch.nn import CrossEntropyLoss
|
29 |
+
|
30 |
+
from transformers.cache_utils import Cache
|
31 |
+
from transformers.modeling_outputs import (
|
32 |
+
BaseModelOutputWithPast,
|
33 |
+
CausalLMOutputWithPast,
|
34 |
+
)
|
35 |
+
from transformers.modeling_utils import PreTrainedModel
|
36 |
+
from transformers.utils import logging, is_flash_attn_greater_or_equal_2_10
|
37 |
+
|
38 |
+
from .configuration_stablelm_epoch import StableLMEpochConfig
|
39 |
+
|
40 |
+
try:
|
41 |
+
from flash_attn import flash_attn_func, flash_attn_varlen_func
|
42 |
+
from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input
|
43 |
+
except:
|
44 |
+
flash_attn_func, flash_attn_varlen_func = None, None
|
45 |
+
index_first_axis, pad_input, unpad_input = None, None, None
|
46 |
+
|
47 |
+
|
48 |
+
logger = logging.get_logger(__name__)
|
49 |
+
|
50 |
+
|
51 |
+
# Copied from transformers.models.llama.modeling_llama._get_unpad_data
|
52 |
+
def _get_unpad_data(attention_mask):
|
53 |
+
seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
|
54 |
+
indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
|
55 |
+
max_seqlen_in_batch = seqlens_in_batch.max().item()
|
56 |
+
cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
|
57 |
+
return (
|
58 |
+
indices,
|
59 |
+
cu_seqlens,
|
60 |
+
max_seqlen_in_batch,
|
61 |
+
)
|
62 |
+
|
63 |
+
|
64 |
+
# Copied from transformers.models.bart.modeling_bart._make_causal_mask
|
65 |
+
def _make_causal_mask(
|
66 |
+
input_ids_shape: torch.Size,
|
67 |
+
dtype: torch.dtype,
|
68 |
+
device: torch.device,
|
69 |
+
past_key_values_length: int = 0,
|
70 |
+
):
|
71 |
+
"""Make causal mask used for bi-directional self-attention."""
|
72 |
+
batch_size, tgt_len = input_ids_shape
|
73 |
+
mask = torch.full((tgt_len, tgt_len), torch.finfo(torch.float16).min, device=device)
|
74 |
+
mask_cond = torch.arange(mask.size(-1), device=device)
|
75 |
+
mask.masked_fill_(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0)
|
76 |
+
mask = mask.to(dtype)
|
77 |
+
if past_key_values_length > 0:
|
78 |
+
mask = torch.cat([torch.zeros(tgt_len, past_key_values_length, dtype=dtype, device=device), mask], dim=-1)
|
79 |
+
return mask[None, None, :, :].expand(batch_size, 1, tgt_len, tgt_len + past_key_values_length)
|
80 |
+
|
81 |
+
|
82 |
+
# Copied from transformers.models.bart.modeling_bart._expand_mask
|
83 |
+
def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
|
84 |
+
"""Expands attention_mask from `[batch_size, seq_len]` to `[batch_size, 1, tgt_seq_len, src_seq_len]`."""
|
85 |
+
batch_size, src_len = mask.size()
|
86 |
+
tgt_len = tgt_len if tgt_len is not None else src_len
|
87 |
+
|
88 |
+
expanded_mask = mask[:, None, None, :].expand(batch_size, 1, tgt_len, src_len).to(dtype)
|
89 |
+
inverted_mask = 1.0 - expanded_mask
|
90 |
+
|
91 |
+
return inverted_mask.masked_fill(
|
92 |
+
inverted_mask.to(torch.bool), torch.finfo(dtype).min
|
93 |
+
)
|
94 |
+
|
95 |
+
|
96 |
+
class RotaryEmbedding(nn.Module):
|
97 |
+
def __init__(
|
98 |
+
self,
|
99 |
+
dim: int,
|
100 |
+
max_position_embeddings: int,
|
101 |
+
base: int = 10_000,
|
102 |
+
device: Optional[torch.device] = None,
|
103 |
+
):
|
104 |
+
super().__init__()
|
105 |
+
|
106 |
+
self.dim = dim
|
107 |
+
self.max_position_embeddings = max_position_embeddings
|
108 |
+
self.base = base
|
109 |
+
inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2, device=device, dtype=torch.float32) / self.dim))
|
110 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
111 |
+
|
112 |
+
# Build here to make `torch.jit.trace` work.
|
113 |
+
self._set_cos_sin_cache(
|
114 |
+
seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype(),
|
115 |
+
)
|
116 |
+
|
117 |
+
def _set_cos_sin_cache(self, seq_len: int, device: torch.device, dtype: torch.dtype):
|
118 |
+
self.max_seq_len_cached = seq_len
|
119 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.float32)
|
120 |
+
|
121 |
+
# Don't do einsum, it converts fp32 to fp16 under AMP
|
122 |
+
# freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
123 |
+
freqs = torch.outer(t, self.inv_freq)
|
124 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
125 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
126 |
+
self.register_buffer("cos_cached", emb.cos()[None, None, :, :].to(dtype), persistent=False)
|
127 |
+
self.register_buffer("sin_cached", emb.sin()[None, None, :, :].to(dtype), persistent=False)
|
128 |
+
|
129 |
+
def forward(self, x: torch.Tensor, seq_len: Optional[int] = None):
|
130 |
+
# x: [batch_size, num_heads, seq_len, head_size]
|
131 |
+
if seq_len > self.max_seq_len_cached:
|
132 |
+
self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=torch.get_default_dtype())
|
133 |
+
return (
|
134 |
+
self.cos_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
|
135 |
+
self.sin_cached[:, :, :seq_len, ...].to(dtype=x.dtype),
|
136 |
+
)
|
137 |
+
|
138 |
+
|
139 |
+
def rotate_half(x: torch.Tensor):
|
140 |
+
"""Rotates half the hidden dims of the input."""
|
141 |
+
x1, x2 = torch.chunk(x, 2, dim=-1)
|
142 |
+
return torch.cat((-x2, x1), dim=-1)
|
143 |
+
|
144 |
+
|
145 |
+
def apply_rotary_pos_emb(q, k, cos, sin, position_ids):
|
146 |
+
# The first two dimensions of cos and sin are always 1, so we can `squeeze` them.
|
147 |
+
cos = cos.squeeze(1).squeeze(0) # [seq_len, dim]
|
148 |
+
sin = sin.squeeze(1).squeeze(0) # [seq_len, dim]
|
149 |
+
cos = cos[position_ids].unsqueeze(1) # [batch_size, 1, seq_len, dim]
|
150 |
+
sin = sin[position_ids].unsqueeze(1) # [batch_size, 1, seq_len, dim]
|
151 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
152 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
153 |
+
return q_embed, k_embed
|
154 |
+
|
155 |
+
|
156 |
+
class MLP(nn.Module):
|
157 |
+
def __init__(self, config: StableLMEpochConfig):
|
158 |
+
super().__init__()
|
159 |
+
self.config = config
|
160 |
+
self.hidden_size = config.hidden_size
|
161 |
+
self.intermediate_size = config.intermediate_size
|
162 |
+
self.gate_proj = nn.Linear(config.hidden_size, config.intermediate_size, bias=False)
|
163 |
+
self.up_proj = nn.Linear(config.hidden_size, config.intermediate_size, bias=False)
|
164 |
+
self.down_proj = nn.Linear(config.intermediate_size, config.hidden_size, bias=False)
|
165 |
+
self.act_fn = nn.SiLU()
|
166 |
+
|
167 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
168 |
+
return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
|
169 |
+
|
170 |
+
|
171 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
172 |
+
"""
|
173 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
174 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
175 |
+
"""
|
176 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
177 |
+
if n_rep == 1:
|
178 |
+
return hidden_states
|
179 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
180 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
181 |
+
|
182 |
+
|
183 |
+
class Attention(nn.Module):
|
184 |
+
def __init__(self, config: StableLMEpochConfig):
|
185 |
+
super().__init__()
|
186 |
+
self.config = config
|
187 |
+
self.hidden_size = config.hidden_size
|
188 |
+
self.num_heads = config.num_attention_heads
|
189 |
+
self.head_dim = self.hidden_size // self.num_heads
|
190 |
+
self.num_key_value_heads = config.num_key_value_heads
|
191 |
+
self.num_key_value_groups = self.num_heads // self.num_key_value_heads
|
192 |
+
self.max_position_embeddings = config.max_position_embeddings
|
193 |
+
self.is_causal = True
|
194 |
+
self.attention_dropout = config.attention_dropout
|
195 |
+
|
196 |
+
if (self.head_dim * self.num_heads) != self.hidden_size:
|
197 |
+
raise ValueError(
|
198 |
+
f"hidden_size must be divisible by num_heads (got `hidden_size`: {self.hidden_size}"
|
199 |
+
f" and `num_heads`: {self.num_heads})."
|
200 |
+
)
|
201 |
+
|
202 |
+
self.q_proj = nn.Linear(self.hidden_size, self.num_heads * self.head_dim, bias=config.use_qkv_bias)
|
203 |
+
self.k_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.use_qkv_bias)
|
204 |
+
self.v_proj = nn.Linear(self.hidden_size, self.num_key_value_heads * self.head_dim, bias=config.use_qkv_bias)
|
205 |
+
self.o_proj = nn.Linear(self.hidden_size, self.hidden_size, bias=False)
|
206 |
+
|
207 |
+
self._init_rope()
|
208 |
+
|
209 |
+
def _init_rope(self):
|
210 |
+
self.rotary_ndims = int(self.head_dim * self.config.rope_pct)
|
211 |
+
self.rotary_emb = RotaryEmbedding(
|
212 |
+
self.rotary_ndims,
|
213 |
+
max_position_embeddings=self.config.max_position_embeddings,
|
214 |
+
base=self.config.rope_theta,
|
215 |
+
)
|
216 |
+
|
217 |
+
def forward(
|
218 |
+
self,
|
219 |
+
hidden_states: torch.FloatTensor,
|
220 |
+
attention_mask: torch.FloatTensor,
|
221 |
+
position_ids: torch.LongTensor,
|
222 |
+
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
223 |
+
output_attentions: Optional[bool] = False,
|
224 |
+
use_cache: Optional[bool] = False,
|
225 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
226 |
+
bsz, q_len, _ = hidden_states.size()
|
227 |
+
|
228 |
+
query_states = self.q_proj(hidden_states)
|
229 |
+
key_states = self.k_proj(hidden_states)
|
230 |
+
value_states = self.v_proj(hidden_states)
|
231 |
+
|
232 |
+
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
233 |
+
key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
234 |
+
value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
235 |
+
|
236 |
+
query_rot = query_states[..., : self.rotary_ndims]
|
237 |
+
query_pass = query_states[..., self.rotary_ndims :]
|
238 |
+
key_rot = key_states[..., : self.rotary_ndims]
|
239 |
+
key_pass = key_states[..., self.rotary_ndims :]
|
240 |
+
|
241 |
+
kv_seq_len = key_states.shape[-2]
|
242 |
+
if past_key_value is not None:
|
243 |
+
kv_seq_len += past_key_value[0].shape[-2]
|
244 |
+
cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
|
245 |
+
query_states, key_states = apply_rotary_pos_emb(query_rot, key_rot, cos, sin, position_ids)
|
246 |
+
|
247 |
+
# [batch_size, num_heads, seq_len, head_dim]
|
248 |
+
query_states = torch.cat((query_states, query_pass), dim=-1)
|
249 |
+
key_states = torch.cat((key_states, key_pass), dim=-1)
|
250 |
+
|
251 |
+
if past_key_value is not None:
|
252 |
+
# Reuse k, v, self_attention
|
253 |
+
key_states = torch.cat((past_key_value[0], key_states), dim=2)
|
254 |
+
value_states = torch.cat((past_key_value[1], value_states), dim=2)
|
255 |
+
|
256 |
+
past_key_value = (key_states, value_states) if use_cache else None
|
257 |
+
|
258 |
+
# Repeat k/v heads if n_kv_heads < n_heads
|
259 |
+
key_states = repeat_kv(key_states, self.num_key_value_groups)
|
260 |
+
value_states = repeat_kv(value_states, self.num_key_value_groups)
|
261 |
+
|
262 |
+
attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
|
263 |
+
|
264 |
+
if attn_weights.size() != (bsz, self.num_heads, q_len, kv_seq_len):
|
265 |
+
raise ValueError(
|
266 |
+
f"Attention weights should be of size {(bsz, self.num_heads, q_len, kv_seq_len)}, but is"
|
267 |
+
f" {attn_weights.size()}"
|
268 |
+
)
|
269 |
+
|
270 |
+
if attention_mask is not None:
|
271 |
+
if attention_mask.size() != (bsz, 1, q_len, kv_seq_len):
|
272 |
+
raise ValueError(
|
273 |
+
f"Attention mask should be of size {(bsz, 1, q_len, kv_seq_len)}, but is {attention_mask.size()}"
|
274 |
+
)
|
275 |
+
attn_weights = attn_weights + attention_mask
|
276 |
+
|
277 |
+
# Upcast attention to fp32
|
278 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
|
279 |
+
attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
|
280 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
281 |
+
|
282 |
+
if attn_output.size() != (bsz, self.num_heads, q_len, self.head_dim):
|
283 |
+
raise ValueError(
|
284 |
+
f"`attn_output` should be of size {(bsz, self.num_heads, q_len, self.head_dim)}, but is"
|
285 |
+
f" {attn_output.size()}"
|
286 |
+
)
|
287 |
+
|
288 |
+
# Merge heads
|
289 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
290 |
+
attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
|
291 |
+
|
292 |
+
# Final linear projection
|
293 |
+
attn_output = self.o_proj(attn_output)
|
294 |
+
|
295 |
+
if not output_attentions:
|
296 |
+
attn_weights = None
|
297 |
+
|
298 |
+
return attn_output, attn_weights, past_key_value
|
299 |
+
|
300 |
+
|
301 |
+
class FlashAttention2(Attention):
|
302 |
+
"""
|
303 |
+
Reference: https://github.com/huggingface/transformers/blob/5d36025ca13d05151b7a0c761e90d429c4644a30/src/transformers/models/llama/modeling_llama.py#L456
|
304 |
+
"""
|
305 |
+
|
306 |
+
def __init__(self, *args, **kwargs):
|
307 |
+
super().__init__(*args, **kwargs)
|
308 |
+
|
309 |
+
# TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
|
310 |
+
# flash_attn<2.1 generates top-left aligned causal mask, while what is needed here is bottom-right alignement, that was made default for flash_attn>=2.1. This attribute is used to handle this difference. Reference: https://github.com/Dao-AILab/flash-attention/releases/tag/v2.1.0.
|
311 |
+
# Beware that with flash_attn<2.1, using q_seqlen != k_seqlen (except for the case q_seqlen == 1) produces a wrong mask (top-left).
|
312 |
+
self._flash_attn_uses_top_left_mask = not is_flash_attn_greater_or_equal_2_10()
|
313 |
+
|
314 |
+
def forward(
|
315 |
+
self,
|
316 |
+
hidden_states: torch.Tensor,
|
317 |
+
attention_mask: Optional[torch.LongTensor] = None,
|
318 |
+
position_ids: Optional[torch.LongTensor] = None,
|
319 |
+
past_key_value: Optional[Cache] = None,
|
320 |
+
output_attentions: bool = False,
|
321 |
+
use_cache: bool = False,
|
322 |
+
**kwargs,
|
323 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
324 |
+
# FlashAttention2 attention does not support output_attentions
|
325 |
+
if "padding_mask" in kwargs:
|
326 |
+
warnings.warn(
|
327 |
+
"Passing `padding_mask` is deprecated and will be removed in v4.37. Please make sure use `attention_mask` instead.`"
|
328 |
+
)
|
329 |
+
|
330 |
+
# overwrite attention_mask with padding_mask
|
331 |
+
attention_mask = kwargs.pop("padding_mask")
|
332 |
+
|
333 |
+
output_attentions = False
|
334 |
+
|
335 |
+
bsz, q_len, _ = hidden_states.size()
|
336 |
+
|
337 |
+
query_states = self.q_proj(hidden_states)
|
338 |
+
key_states = self.k_proj(hidden_states)
|
339 |
+
value_states = self.v_proj(hidden_states)
|
340 |
+
|
341 |
+
# Flash attention requires the input to have the shape
|
342 |
+
# batch_size x seq_length x head_dim x hidden_dim
|
343 |
+
# therefore we just need to keep the original shape
|
344 |
+
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
345 |
+
key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
346 |
+
value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
|
347 |
+
|
348 |
+
query_rot = query_states[..., : self.rotary_ndims]
|
349 |
+
query_pass = query_states[..., self.rotary_ndims :]
|
350 |
+
key_rot = key_states[..., : self.rotary_ndims]
|
351 |
+
key_pass = key_states[..., self.rotary_ndims :]
|
352 |
+
|
353 |
+
kv_seq_len = key_states.shape[-2]
|
354 |
+
if past_key_value is not None:
|
355 |
+
kv_seq_len += past_key_value[0].shape[-2]
|
356 |
+
cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
|
357 |
+
query_states, key_states = apply_rotary_pos_emb(query_rot, key_rot, cos, sin, position_ids)
|
358 |
+
|
359 |
+
# [batch_size, num_heads, seq_len, head_dim]
|
360 |
+
query_states = torch.cat((query_states, query_pass), dim=-1)
|
361 |
+
key_states = torch.cat((key_states, key_pass), dim=-1)
|
362 |
+
|
363 |
+
if past_key_value is not None:
|
364 |
+
# Reuse k, v, self_attention
|
365 |
+
key_states = torch.cat((past_key_value[0], key_states), dim=2)
|
366 |
+
value_states = torch.cat((past_key_value[1], value_states), dim=2)
|
367 |
+
|
368 |
+
past_key_value = (key_states, value_states) if use_cache else None
|
369 |
+
|
370 |
+
# TODO: These transpose are quite inefficient but Flash Attention requires the layout [batch_size, sequence_length, num_heads, head_dim]. We would need to refactor the KV cache
|
371 |
+
# to be able to avoid many of these transpose/reshape/view.
|
372 |
+
query_states = query_states.transpose(1, 2)
|
373 |
+
key_states = key_states.transpose(1, 2)
|
374 |
+
value_states = value_states.transpose(1, 2)
|
375 |
+
|
376 |
+
dropout_rate = self.attention_dropout if self.training else 0.0
|
377 |
+
|
378 |
+
attn_output = self._flash_attention_forward(
|
379 |
+
query_states, key_states, value_states, attention_mask, q_len, dropout=dropout_rate
|
380 |
+
)
|
381 |
+
attn_output = attn_output.reshape(bsz, q_len, self.hidden_size).contiguous()
|
382 |
+
attn_output = self.o_proj(attn_output)
|
383 |
+
|
384 |
+
if not output_attentions:
|
385 |
+
attn_weights = None
|
386 |
+
|
387 |
+
return attn_output, attn_weights, past_key_value
|
388 |
+
|
389 |
+
def _flash_attention_forward(
|
390 |
+
self, query_states, key_states, value_states, attention_mask, query_length, dropout=0.0, softmax_scale=None
|
391 |
+
):
|
392 |
+
"""
|
393 |
+
Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
|
394 |
+
first unpad the input, then computes the attention scores and pad the final attention scores.
|
395 |
+
|
396 |
+
Args:
|
397 |
+
query_states (`torch.Tensor`):
|
398 |
+
Input query states to be passed to Flash Attention API
|
399 |
+
key_states (`torch.Tensor`):
|
400 |
+
Input key states to be passed to Flash Attention API
|
401 |
+
value_states (`torch.Tensor`):
|
402 |
+
Input value states to be passed to Flash Attention API
|
403 |
+
attention_mask (`torch.Tensor`):
|
404 |
+
The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
|
405 |
+
position of padding tokens and 1 for the position of non-padding tokens.
|
406 |
+
dropout (`int`, *optional*):
|
407 |
+
Attention dropout
|
408 |
+
softmax_scale (`float`, *optional*):
|
409 |
+
The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
|
410 |
+
"""
|
411 |
+
if not self._flash_attn_uses_top_left_mask:
|
412 |
+
causal = self.is_causal
|
413 |
+
else:
|
414 |
+
# TODO: Remove the `query_length != 1` check once Flash Attention for RoCm is bumped to 2.1. For details, please see the comment in FlashAttention2 __init__.
|
415 |
+
causal = self.is_causal and query_length != 1
|
416 |
+
|
417 |
+
# Contains at least one padding token in the sequence
|
418 |
+
if attention_mask is not None:
|
419 |
+
batch_size = query_states.shape[0]
|
420 |
+
query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
|
421 |
+
query_states, key_states, value_states, attention_mask, query_length
|
422 |
+
)
|
423 |
+
|
424 |
+
cu_seqlens_q, cu_seqlens_k = cu_seq_lens
|
425 |
+
max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
|
426 |
+
|
427 |
+
attn_output_unpad = flash_attn_varlen_func(
|
428 |
+
query_states,
|
429 |
+
key_states,
|
430 |
+
value_states,
|
431 |
+
cu_seqlens_q=cu_seqlens_q,
|
432 |
+
cu_seqlens_k=cu_seqlens_k,
|
433 |
+
max_seqlen_q=max_seqlen_in_batch_q,
|
434 |
+
max_seqlen_k=max_seqlen_in_batch_k,
|
435 |
+
dropout_p=dropout,
|
436 |
+
softmax_scale=softmax_scale,
|
437 |
+
causal=causal,
|
438 |
+
)
|
439 |
+
|
440 |
+
attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
|
441 |
+
else:
|
442 |
+
attn_output = flash_attn_func(
|
443 |
+
query_states, key_states, value_states, dropout, softmax_scale=softmax_scale, causal=causal
|
444 |
+
)
|
445 |
+
|
446 |
+
return attn_output
|
447 |
+
|
448 |
+
def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
|
449 |
+
indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
|
450 |
+
batch_size, kv_seq_len, num_key_value_heads, head_dim = key_layer.shape
|
451 |
+
|
452 |
+
key_layer = index_first_axis(
|
453 |
+
key_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
|
454 |
+
)
|
455 |
+
value_layer = index_first_axis(
|
456 |
+
value_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
|
457 |
+
)
|
458 |
+
if query_length == kv_seq_len:
|
459 |
+
query_layer = index_first_axis(
|
460 |
+
query_layer.reshape(batch_size * kv_seq_len, self.num_heads, head_dim), indices_k
|
461 |
+
)
|
462 |
+
cu_seqlens_q = cu_seqlens_k
|
463 |
+
max_seqlen_in_batch_q = max_seqlen_in_batch_k
|
464 |
+
indices_q = indices_k
|
465 |
+
elif query_length == 1:
|
466 |
+
max_seqlen_in_batch_q = 1
|
467 |
+
cu_seqlens_q = torch.arange(
|
468 |
+
batch_size + 1, dtype=torch.int32, device=query_layer.device
|
469 |
+
) # There is a memcpy here, that is very bad.
|
470 |
+
indices_q = cu_seqlens_q[:-1]
|
471 |
+
query_layer = query_layer.squeeze(1)
|
472 |
+
else:
|
473 |
+
# The -q_len: slice assumes left padding.
|
474 |
+
attention_mask = attention_mask[:, -query_length:]
|
475 |
+
query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
|
476 |
+
|
477 |
+
return (
|
478 |
+
query_layer,
|
479 |
+
key_layer,
|
480 |
+
value_layer,
|
481 |
+
indices_q,
|
482 |
+
(cu_seqlens_q, cu_seqlens_k),
|
483 |
+
(max_seqlen_in_batch_q, max_seqlen_in_batch_k),
|
484 |
+
)
|
485 |
+
|
486 |
+
|
487 |
+
ATTENTION_CLASSES = {
|
488 |
+
"eager": Attention,
|
489 |
+
"flash_attention_2": FlashAttention2,
|
490 |
+
}
|
491 |
+
|
492 |
+
|
493 |
+
class DecoderLayer(nn.Module):
|
494 |
+
def __init__(self, config: StableLMEpochConfig):
|
495 |
+
super().__init__()
|
496 |
+
self.self_attn = ATTENTION_CLASSES[config._attn_implementation](config=config)
|
497 |
+
self.mlp = MLP(config)
|
498 |
+
self.input_layernorm = nn.LayerNorm(config.hidden_size, eps=config.norm_eps)
|
499 |
+
self.post_attention_layernorm = nn.LayerNorm(config.hidden_size, eps=config.norm_eps)
|
500 |
+
|
501 |
+
def forward(
|
502 |
+
self,
|
503 |
+
hidden_states: Optional[torch.FloatTensor],
|
504 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
505 |
+
position_ids: Optional[torch.LongTensor] = None,
|
506 |
+
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
507 |
+
output_attentions: Optional[bool] = False,
|
508 |
+
use_cache: Optional[bool] = False,
|
509 |
+
) -> Union[Tuple[torch.Tensor], Optional[Tuple[torch.Tensor, Tuple[torch.FloatTensor, ...]]]]:
|
510 |
+
residual = hidden_states
|
511 |
+
|
512 |
+
hidden_states = self.input_layernorm(hidden_states)
|
513 |
+
|
514 |
+
# Self Attention
|
515 |
+
hidden_states, self_attn_weights, present_key_value = self.self_attn(
|
516 |
+
hidden_states=hidden_states,
|
517 |
+
attention_mask=attention_mask,
|
518 |
+
position_ids=position_ids,
|
519 |
+
past_key_value=past_key_value,
|
520 |
+
output_attentions=output_attentions,
|
521 |
+
use_cache=use_cache,
|
522 |
+
)
|
523 |
+
hidden_states = residual + hidden_states
|
524 |
+
|
525 |
+
# Fully Connected
|
526 |
+
residual = hidden_states
|
527 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
528 |
+
hidden_states = self.mlp(hidden_states)
|
529 |
+
hidden_states = residual + hidden_states
|
530 |
+
|
531 |
+
outputs = (hidden_states,)
|
532 |
+
|
533 |
+
if output_attentions:
|
534 |
+
outputs += (self_attn_weights,)
|
535 |
+
|
536 |
+
if use_cache:
|
537 |
+
outputs += (present_key_value,)
|
538 |
+
|
539 |
+
return outputs
|
540 |
+
|
541 |
+
|
542 |
+
class StableLMEpochPreTrainedModel(PreTrainedModel):
|
543 |
+
"""An abstract class to handle weights initialization and a simple interface
|
544 |
+
for downloading and loading pretrained models.
|
545 |
+
"""
|
546 |
+
|
547 |
+
config_class = StableLMEpochConfig
|
548 |
+
base_model_prefix = "model"
|
549 |
+
supports_gradient_checkpointing = True
|
550 |
+
_no_split_modules = ["DecoderLayer"]
|
551 |
+
_skip_keys_device_placement = "past_key_values"
|
552 |
+
_supports_flash_attn_2 = True
|
553 |
+
|
554 |
+
def _init_weights(self, module: nn.Module):
|
555 |
+
"""Initialize the weights"""
|
556 |
+
if isinstance(module, nn.Linear):
|
557 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
558 |
+
if module.bias is not None:
|
559 |
+
module.bias.data.zero_()
|
560 |
+
elif isinstance(module, nn.Embedding):
|
561 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
562 |
+
if module.padding_idx is not None:
|
563 |
+
module.weight.data[module.padding_idx].zero_()
|
564 |
+
elif isinstance(module, nn.LayerNorm):
|
565 |
+
module.bias.data.zero_()
|
566 |
+
module.weight.data.fill_(1.0)
|
567 |
+
|
568 |
+
def _set_gradient_checkpointing(self, module: nn.Module, value=False):
|
569 |
+
if isinstance(module, StableLMEpochModel):
|
570 |
+
module.gradient_checkpointing = value
|
571 |
+
|
572 |
+
|
573 |
+
class StableLMEpochModel(StableLMEpochPreTrainedModel):
|
574 |
+
def __init__(self, config: StableLMEpochConfig):
|
575 |
+
super().__init__(config)
|
576 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, config.pad_token_id)
|
577 |
+
self.layers = nn.ModuleList([DecoderLayer(config) for _ in range(config.num_hidden_layers)])
|
578 |
+
self.norm = nn.LayerNorm(config.hidden_size, eps=config.norm_eps)
|
579 |
+
|
580 |
+
self._use_flash_attention_2 = config._attn_implementation == "flash_attention_2"
|
581 |
+
self.gradient_checkpointing = False
|
582 |
+
# Initialize weights and apply final processing
|
583 |
+
self.post_init()
|
584 |
+
|
585 |
+
def get_input_embeddings(self):
|
586 |
+
return self.embed_tokens
|
587 |
+
|
588 |
+
def set_input_embeddings(self, value: nn.Module):
|
589 |
+
self.embed_tokens = value
|
590 |
+
|
591 |
+
# Copied from transformers.models.bart.modeling_bart.BartDecoder._prepare_decoder_attention_mask
|
592 |
+
def _prepare_decoder_attention_mask(
|
593 |
+
self,
|
594 |
+
attention_mask: torch.Tensor,
|
595 |
+
input_shape: torch.Size,
|
596 |
+
inputs_embeds: torch.Tensor,
|
597 |
+
past_key_values_length: int,
|
598 |
+
):
|
599 |
+
# Create causal mask
|
600 |
+
# [batch_size, seq_len] -> [batch_size, 1, tgt_seq_len, src_seq_len]
|
601 |
+
combined_attention_mask = None
|
602 |
+
if input_shape[-1] > 1:
|
603 |
+
combined_attention_mask = _make_causal_mask(
|
604 |
+
input_shape,
|
605 |
+
inputs_embeds.dtype,
|
606 |
+
device=inputs_embeds.device,
|
607 |
+
past_key_values_length=past_key_values_length,
|
608 |
+
)
|
609 |
+
|
610 |
+
if attention_mask is not None:
|
611 |
+
# [batch_size, seq_len] -> [batch_size, 1, tgt_seq_len, src_seq_len]
|
612 |
+
expanded_attn_mask = _expand_mask(
|
613 |
+
attention_mask, inputs_embeds.dtype, tgt_len=input_shape[-1]
|
614 |
+
).to(inputs_embeds.device)
|
615 |
+
combined_attention_mask = expanded_attn_mask if combined_attention_mask is None else expanded_attn_mask + combined_attention_mask
|
616 |
+
|
617 |
+
return combined_attention_mask
|
618 |
+
|
619 |
+
def forward(
|
620 |
+
self,
|
621 |
+
input_ids: Optional[torch.LongTensor] = None,
|
622 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
623 |
+
position_ids: Optional[torch.LongTensor] = None,
|
624 |
+
past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None,
|
625 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
626 |
+
use_cache: Optional[bool] = None,
|
627 |
+
output_attentions: Optional[bool] = None,
|
628 |
+
output_hidden_states: Optional[bool] = None,
|
629 |
+
return_dict: Optional[bool] = None,
|
630 |
+
) -> Union[Tuple, BaseModelOutputWithPast]:
|
631 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
632 |
+
output_hidden_states = output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
633 |
+
use_cache = use_cache if use_cache is not None else self.config.use_cache
|
634 |
+
|
635 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
636 |
+
|
637 |
+
# Retrieve input_ids and inputs_embeds
|
638 |
+
if input_ids is not None and inputs_embeds is not None:
|
639 |
+
raise ValueError(
|
640 |
+
"You cannot specify both decoder_input_ids and decoder_inputs_embeds at the same time"
|
641 |
+
)
|
642 |
+
elif input_ids is not None:
|
643 |
+
batch_size, seq_length = input_ids.shape
|
644 |
+
elif inputs_embeds is not None:
|
645 |
+
batch_size, seq_length, _ = inputs_embeds.shape
|
646 |
+
else:
|
647 |
+
raise ValueError(
|
648 |
+
"You have to specify either decoder_input_ids or decoder_inputs_embeds"
|
649 |
+
)
|
650 |
+
|
651 |
+
seq_length_with_past = seq_length
|
652 |
+
past_key_values_length = 0
|
653 |
+
|
654 |
+
if position_ids is None:
|
655 |
+
device = input_ids.device if input_ids is not None else inputs_embeds.device
|
656 |
+
position_ids = torch.arange(
|
657 |
+
past_key_values_length,
|
658 |
+
seq_length + past_key_values_length,
|
659 |
+
dtype=torch.long,
|
660 |
+
device=device,
|
661 |
+
)
|
662 |
+
position_ids = position_ids.unsqueeze(0).view(-1, seq_length)
|
663 |
+
else:
|
664 |
+
position_ids = position_ids.view(-1, seq_length).long()
|
665 |
+
|
666 |
+
if inputs_embeds is None:
|
667 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
668 |
+
# Embed positions
|
669 |
+
if self._use_flash_attention_2:
|
670 |
+
# 2d mask is passed through the layers
|
671 |
+
attention_mask = attention_mask if (attention_mask is not None and 0 in attention_mask) else None
|
672 |
+
else:
|
673 |
+
if attention_mask is None:
|
674 |
+
attention_mask = torch.ones(
|
675 |
+
(batch_size, seq_length_with_past),
|
676 |
+
dtype=torch.bool,
|
677 |
+
device=inputs_embeds.device,
|
678 |
+
)
|
679 |
+
attention_mask = self._prepare_decoder_attention_mask(
|
680 |
+
attention_mask,
|
681 |
+
(batch_size, seq_length),
|
682 |
+
inputs_embeds,
|
683 |
+
past_key_values_length,
|
684 |
+
)
|
685 |
+
|
686 |
+
hidden_states = inputs_embeds
|
687 |
+
|
688 |
+
if self.gradient_checkpointing and self.training:
|
689 |
+
if use_cache:
|
690 |
+
logger.warning(
|
691 |
+
"`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..."
|
692 |
+
)
|
693 |
+
use_cache = False
|
694 |
+
|
695 |
+
# Decoder layers
|
696 |
+
all_hidden_states = () if output_hidden_states else None
|
697 |
+
all_self_attns = () if output_attentions else None
|
698 |
+
next_decoder_cache = () if use_cache else None
|
699 |
+
|
700 |
+
for idx, decoder_layer in enumerate(self.layers):
|
701 |
+
if output_hidden_states:
|
702 |
+
all_hidden_states += (hidden_states,)
|
703 |
+
|
704 |
+
past_key_value = (
|
705 |
+
past_key_values[idx] if past_key_values is not None else None
|
706 |
+
)
|
707 |
+
|
708 |
+
if self.gradient_checkpointing and self.training:
|
709 |
+
|
710 |
+
def create_custom_forward(module):
|
711 |
+
def custom_forward(*inputs):
|
712 |
+
# None for past_key_value
|
713 |
+
return module(*inputs, past_key_value, output_attentions)
|
714 |
+
|
715 |
+
return custom_forward
|
716 |
+
|
717 |
+
layer_outputs = torch.utils.checkpoint.checkpoint(
|
718 |
+
create_custom_forward(decoder_layer),
|
719 |
+
hidden_states,
|
720 |
+
attention_mask,
|
721 |
+
position_ids,
|
722 |
+
)
|
723 |
+
else:
|
724 |
+
layer_outputs = decoder_layer(
|
725 |
+
hidden_states,
|
726 |
+
attention_mask=attention_mask,
|
727 |
+
position_ids=position_ids,
|
728 |
+
past_key_value=past_key_value,
|
729 |
+
output_attentions=output_attentions,
|
730 |
+
use_cache=use_cache,
|
731 |
+
)
|
732 |
+
|
733 |
+
hidden_states = layer_outputs[0]
|
734 |
+
|
735 |
+
if use_cache:
|
736 |
+
next_decoder_cache += (layer_outputs[2 if output_attentions else 1],)
|
737 |
+
|
738 |
+
if output_attentions:
|
739 |
+
all_self_attns += (layer_outputs[1],)
|
740 |
+
|
741 |
+
hidden_states = self.norm(hidden_states)
|
742 |
+
|
743 |
+
# Add hidden states from the last decoder layer
|
744 |
+
if output_hidden_states:
|
745 |
+
all_hidden_states += (hidden_states,)
|
746 |
+
|
747 |
+
next_cache = next_decoder_cache if use_cache else None
|
748 |
+
if not return_dict:
|
749 |
+
return tuple(
|
750 |
+
v
|
751 |
+
for v in [hidden_states, next_cache, all_hidden_states, all_self_attns]
|
752 |
+
if v is not None
|
753 |
+
)
|
754 |
+
return BaseModelOutputWithPast(
|
755 |
+
last_hidden_state=hidden_states,
|
756 |
+
past_key_values=next_cache,
|
757 |
+
hidden_states=all_hidden_states,
|
758 |
+
attentions=all_self_attns,
|
759 |
+
)
|
760 |
+
|
761 |
+
|
762 |
+
class StableLMEpochForCausalLM(StableLMEpochPreTrainedModel):
|
763 |
+
_tied_weights_keys = ["lm_head.weight"]
|
764 |
+
|
765 |
+
def __init__(self, config: StableLMEpochConfig):
|
766 |
+
super().__init__(config)
|
767 |
+
|
768 |
+
self.model = StableLMEpochModel(config)
|
769 |
+
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
770 |
+
|
771 |
+
# Initialize weights and apply final processing
|
772 |
+
self.post_init()
|
773 |
+
|
774 |
+
def get_input_embeddings(self):
|
775 |
+
return self.model.embed_tokens
|
776 |
+
|
777 |
+
def set_input_embeddings(self, value):
|
778 |
+
self.model.embed_tokens = value
|
779 |
+
|
780 |
+
def get_output_embeddings(self):
|
781 |
+
return self.lm_head
|
782 |
+
|
783 |
+
def set_output_embeddings(self, new_embeddings: nn.Module):
|
784 |
+
self.lm_head = new_embeddings
|
785 |
+
|
786 |
+
def get_decoder(self):
|
787 |
+
return self.model
|
788 |
+
|
789 |
+
def set_decoder(self, decoder):
|
790 |
+
self.model = decoder
|
791 |
+
|
792 |
+
def forward(
|
793 |
+
self,
|
794 |
+
input_ids: Optional[torch.LongTensor] = None,
|
795 |
+
attention_mask: Optional[torch.FloatTensor] = None,
|
796 |
+
position_ids: Optional[torch.LongTensor] = None,
|
797 |
+
past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None,
|
798 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
799 |
+
labels: Optional[torch.LongTensor] = None,
|
800 |
+
use_cache: Optional[bool] = None,
|
801 |
+
output_attentions: Optional[bool] = None,
|
802 |
+
output_hidden_states: Optional[bool] = None,
|
803 |
+
return_dict: Optional[bool] = None,
|
804 |
+
) -> Union[Tuple, CausalLMOutputWithPast]:
|
805 |
+
output_attentions = (
|
806 |
+
output_attentions
|
807 |
+
if output_attentions is not None
|
808 |
+
else self.config.output_attentions
|
809 |
+
)
|
810 |
+
output_hidden_states = (
|
811 |
+
output_hidden_states
|
812 |
+
if output_hidden_states is not None
|
813 |
+
else self.config.output_hidden_states
|
814 |
+
)
|
815 |
+
return_dict = (
|
816 |
+
return_dict if return_dict is not None else self.config.use_return_dict
|
817 |
+
)
|
818 |
+
|
819 |
+
# decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
|
820 |
+
outputs = self.model(
|
821 |
+
input_ids,
|
822 |
+
attention_mask=attention_mask,
|
823 |
+
position_ids=position_ids,
|
824 |
+
past_key_values=past_key_values,
|
825 |
+
inputs_embeds=inputs_embeds,
|
826 |
+
use_cache=use_cache,
|
827 |
+
output_attentions=output_attentions,
|
828 |
+
output_hidden_states=output_hidden_states,
|
829 |
+
return_dict=return_dict,
|
830 |
+
)
|
831 |
+
|
832 |
+
hidden_states = outputs[0]
|
833 |
+
logits = self.lm_head(hidden_states).float()
|
834 |
+
|
835 |
+
loss = None
|
836 |
+
if labels is not None:
|
837 |
+
# Shift so that tokens < n predict n
|
838 |
+
shift_logits = logits[..., :-1, :].contiguous()
|
839 |
+
shift_labels = labels[..., 1:].contiguous()
|
840 |
+
# Flatten the tokens
|
841 |
+
loss_fct = CrossEntropyLoss()
|
842 |
+
shift_logits = shift_logits.view(-1, self.config.vocab_size)
|
843 |
+
shift_labels = shift_labels.view(-1)
|
844 |
+
# Enable model parallelism
|
845 |
+
shift_labels = shift_labels.to(shift_logits.device)
|
846 |
+
loss = loss_fct(shift_logits, shift_labels)
|
847 |
+
|
848 |
+
if not return_dict:
|
849 |
+
output = (logits,) + outputs[1:]
|
850 |
+
return (loss,) + output if loss is not None else output
|
851 |
+
|
852 |
+
return CausalLMOutputWithPast(
|
853 |
+
loss=loss,
|
854 |
+
logits=logits,
|
855 |
+
past_key_values=outputs.past_key_values,
|
856 |
+
hidden_states=outputs.hidden_states,
|
857 |
+
attentions=outputs.attentions,
|
858 |
+
)
|
859 |
+
|
860 |
+
def prepare_inputs_for_generation(
|
861 |
+
self,
|
862 |
+
input_ids,
|
863 |
+
past_key_values: Optional[torch.Tensor] = None,
|
864 |
+
attention_mask: Optional[torch.Tensor] = None,
|
865 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
866 |
+
**kwargs,
|
867 |
+
):
|
868 |
+
# Trim decoder_input_ids if past is used
|
869 |
+
if past_key_values is not None:
|
870 |
+
past_length = past_key_values[0][0].shape[2]
|
871 |
+
|
872 |
+
# Some generation methods already pass only the last input ID
|
873 |
+
if input_ids.shape[1] > past_length:
|
874 |
+
remove_prefix_length = past_length
|
875 |
+
else:
|
876 |
+
# Default to old behavior: keep only final ID
|
877 |
+
remove_prefix_length = input_ids.shape[1] - 1
|
878 |
+
|
879 |
+
input_ids = input_ids[:, remove_prefix_length:]
|
880 |
+
|
881 |
+
position_ids = kwargs.get("position_ids", None)
|
882 |
+
if attention_mask is not None and position_ids is None:
|
883 |
+
# Create position_ids on the fly for batch generation
|
884 |
+
position_ids = attention_mask.long().cumsum(-1) - 1
|
885 |
+
position_ids.masked_fill_(attention_mask == 0, 1)
|
886 |
+
if past_key_values:
|
887 |
+
position_ids = position_ids[:, -1].unsqueeze(-1)
|
888 |
+
|
889 |
+
# If `inputs_embeds` are passed, we only want to use them in the 1st generation step
|
890 |
+
if inputs_embeds is not None and past_key_values is None:
|
891 |
+
model_inputs = {"inputs_embeds": inputs_embeds}
|
892 |
+
else:
|
893 |
+
model_inputs = {"input_ids": input_ids}
|
894 |
+
|
895 |
+
model_inputs.update(
|
896 |
+
{
|
897 |
+
"attention_mask": attention_mask,
|
898 |
+
"past_key_values": past_key_values,
|
899 |
+
"use_cache": kwargs.get("use_cache"),
|
900 |
+
"position_ids": position_ids,
|
901 |
+
}
|
902 |
+
)
|
903 |
+
return model_inputs
|
904 |
+
|
905 |
+
@staticmethod
|
906 |
+
def _reorder_cache(past_key_values, beam_idx):
|
907 |
+
reordered_past = ()
|
908 |
+
for layer_past in past_key_values:
|
909 |
+
reordered_past += (
|
910 |
+
tuple(
|
911 |
+
past_state.index_select(0, beam_idx.to(past_state.device))
|
912 |
+
for past_state in layer_past
|
913 |
+
),
|
914 |
+
)
|
915 |
+
return reordered_past
|
916 |
+
|
917 |
+
|
918 |
+
StableLMEpochConfig.register_for_auto_class()
|
919 |
+
StableLMEpochForCausalLM.register_for_auto_class("AutoModelForCausalLM")
|
runs/Feb19_23-08-06_cccxc542/events.out.tfevents.1708402191.cccxc542.93482.0
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1065ec687b6baaf0f460adf547c466cb2226a5e05ee5483d5bc2a5db5e551894
|
3 |
+
size 59013
|
runs/Feb19_23-08-06_cccxc542/events.out.tfevents.1708406899.cccxc542.93482.1
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b880746d534205b79b0a80157a8b930699e5b566b7a8e0db0a8cf7a7a483a0f7
|
3 |
+
size 828
|
train_results.json
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"epoch": 1.0,
|
3 |
+
"train_loss": 46.613421885577296,
|
4 |
+
"train_runtime": 4597.6924,
|
5 |
+
"train_samples": 61135,
|
6 |
+
"train_samples_per_second": 13.297,
|
7 |
+
"train_steps_per_second": 0.166
|
8 |
+
}
|
trainer_state.json
ADDED
@@ -0,0 +1,1220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"best_metric": null,
|
3 |
+
"best_model_checkpoint": null,
|
4 |
+
"epoch": 0.999345977763244,
|
5 |
+
"eval_steps": 100,
|
6 |
+
"global_step": 764,
|
7 |
+
"is_hyper_param_search": false,
|
8 |
+
"is_local_process_zero": true,
|
9 |
+
"is_world_process_zero": true,
|
10 |
+
"log_history": [
|
11 |
+
{
|
12 |
+
"epoch": 0.0,
|
13 |
+
"learning_rate": 6.493506493506494e-09,
|
14 |
+
"logits/chosen": -2.0615594387054443,
|
15 |
+
"logits/rejected": -1.9222214221954346,
|
16 |
+
"logps/chosen": -3380.6083984375,
|
17 |
+
"logps/rejected": -2521.2978515625,
|
18 |
+
"loss": 0.0001,
|
19 |
+
"rewards/accuracies": 0.0,
|
20 |
+
"rewards/chosen": 0.0,
|
21 |
+
"rewards/margins": 0.0,
|
22 |
+
"rewards/rejected": 0.0,
|
23 |
+
"step": 1
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"epoch": 0.01,
|
27 |
+
"learning_rate": 6.493506493506492e-08,
|
28 |
+
"logits/chosen": -1.674426555633545,
|
29 |
+
"logits/rejected": -1.637134313583374,
|
30 |
+
"logps/chosen": -2549.3515625,
|
31 |
+
"logps/rejected": -2319.4013671875,
|
32 |
+
"loss": 10.0505,
|
33 |
+
"rewards/accuracies": 0.4333333373069763,
|
34 |
+
"rewards/chosen": 0.0008169158827513456,
|
35 |
+
"rewards/margins": 0.0011402772506698966,
|
36 |
+
"rewards/rejected": -0.00032336192089132965,
|
37 |
+
"step": 10
|
38 |
+
},
|
39 |
+
{
|
40 |
+
"epoch": 0.03,
|
41 |
+
"learning_rate": 1.2987012987012984e-07,
|
42 |
+
"logits/chosen": -1.6043205261230469,
|
43 |
+
"logits/rejected": -1.5535523891448975,
|
44 |
+
"logps/chosen": -2340.101318359375,
|
45 |
+
"logps/rejected": -2224.145263671875,
|
46 |
+
"loss": 7.4843,
|
47 |
+
"rewards/accuracies": 0.5200000405311584,
|
48 |
+
"rewards/chosen": 0.00018432810611557215,
|
49 |
+
"rewards/margins": 0.0009077669237740338,
|
50 |
+
"rewards/rejected": -0.0007234388613142073,
|
51 |
+
"step": 20
|
52 |
+
},
|
53 |
+
{
|
54 |
+
"epoch": 0.04,
|
55 |
+
"learning_rate": 1.948051948051948e-07,
|
56 |
+
"logits/chosen": -1.6847426891326904,
|
57 |
+
"logits/rejected": -1.6577625274658203,
|
58 |
+
"logps/chosen": -2983.23681640625,
|
59 |
+
"logps/rejected": -2513.237060546875,
|
60 |
+
"loss": 9.1379,
|
61 |
+
"rewards/accuracies": 0.48000001907348633,
|
62 |
+
"rewards/chosen": 0.010261936113238335,
|
63 |
+
"rewards/margins": 0.004135974682867527,
|
64 |
+
"rewards/rejected": 0.006125961430370808,
|
65 |
+
"step": 30
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"epoch": 0.05,
|
69 |
+
"learning_rate": 2.597402597402597e-07,
|
70 |
+
"logits/chosen": -1.859400987625122,
|
71 |
+
"logits/rejected": -1.8100417852401733,
|
72 |
+
"logps/chosen": -2879.57470703125,
|
73 |
+
"logps/rejected": -2273.878173828125,
|
74 |
+
"loss": 12.271,
|
75 |
+
"rewards/accuracies": 0.5,
|
76 |
+
"rewards/chosen": 0.012033696286380291,
|
77 |
+
"rewards/margins": 0.005555520299822092,
|
78 |
+
"rewards/rejected": 0.006478174589574337,
|
79 |
+
"step": 40
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"epoch": 0.07,
|
83 |
+
"learning_rate": 3.2467532467532465e-07,
|
84 |
+
"logits/chosen": -1.828608751296997,
|
85 |
+
"logits/rejected": -1.805625319480896,
|
86 |
+
"logps/chosen": -2893.784423828125,
|
87 |
+
"logps/rejected": -2551.77294921875,
|
88 |
+
"loss": 8.7411,
|
89 |
+
"rewards/accuracies": 0.5600000023841858,
|
90 |
+
"rewards/chosen": 0.02166888490319252,
|
91 |
+
"rewards/margins": 0.007775471545755863,
|
92 |
+
"rewards/rejected": 0.013893413357436657,
|
93 |
+
"step": 50
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"epoch": 0.08,
|
97 |
+
"learning_rate": 3.896103896103896e-07,
|
98 |
+
"logits/chosen": -1.7459495067596436,
|
99 |
+
"logits/rejected": -1.6628999710083008,
|
100 |
+
"logps/chosen": -3231.689697265625,
|
101 |
+
"logps/rejected": -2554.42919921875,
|
102 |
+
"loss": 9.758,
|
103 |
+
"rewards/accuracies": 0.559999942779541,
|
104 |
+
"rewards/chosen": 0.027519574388861656,
|
105 |
+
"rewards/margins": 0.008895651437342167,
|
106 |
+
"rewards/rejected": 0.018623923882842064,
|
107 |
+
"step": 60
|
108 |
+
},
|
109 |
+
{
|
110 |
+
"epoch": 0.09,
|
111 |
+
"learning_rate": 4.545454545454545e-07,
|
112 |
+
"logits/chosen": -1.8072433471679688,
|
113 |
+
"logits/rejected": -1.7838470935821533,
|
114 |
+
"logps/chosen": -2829.386474609375,
|
115 |
+
"logps/rejected": -2542.68701171875,
|
116 |
+
"loss": 11.0017,
|
117 |
+
"rewards/accuracies": 0.5,
|
118 |
+
"rewards/chosen": 0.024034958332777023,
|
119 |
+
"rewards/margins": 0.006175906863063574,
|
120 |
+
"rewards/rejected": 0.017859051004052162,
|
121 |
+
"step": 70
|
122 |
+
},
|
123 |
+
{
|
124 |
+
"epoch": 0.1,
|
125 |
+
"learning_rate": 4.99976474872689e-07,
|
126 |
+
"logits/chosen": -1.7730411291122437,
|
127 |
+
"logits/rejected": -1.7399647235870361,
|
128 |
+
"logps/chosen": -2769.705322265625,
|
129 |
+
"logps/rejected": -2476.75634765625,
|
130 |
+
"loss": 15.623,
|
131 |
+
"rewards/accuracies": 0.5400000214576721,
|
132 |
+
"rewards/chosen": 0.008623984642326832,
|
133 |
+
"rewards/margins": 0.008157819509506226,
|
134 |
+
"rewards/rejected": 0.0004661638231482357,
|
135 |
+
"step": 80
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"epoch": 0.12,
|
139 |
+
"learning_rate": 4.995583735427465e-07,
|
140 |
+
"logits/chosen": -1.790204644203186,
|
141 |
+
"logits/rejected": -1.7226215600967407,
|
142 |
+
"logps/chosen": -2688.0732421875,
|
143 |
+
"logps/rejected": -2436.649658203125,
|
144 |
+
"loss": 11.9811,
|
145 |
+
"rewards/accuracies": 0.6100000143051147,
|
146 |
+
"rewards/chosen": 0.017978714779019356,
|
147 |
+
"rewards/margins": 0.017238261178135872,
|
148 |
+
"rewards/rejected": 0.0007404519128613174,
|
149 |
+
"step": 90
|
150 |
+
},
|
151 |
+
{
|
152 |
+
"epoch": 0.13,
|
153 |
+
"learning_rate": 4.986184978516146e-07,
|
154 |
+
"logits/chosen": -1.7211675643920898,
|
155 |
+
"logits/rejected": -1.6991230249404907,
|
156 |
+
"logps/chosen": -2611.177001953125,
|
157 |
+
"logps/rejected": -2212.4033203125,
|
158 |
+
"loss": 16.8403,
|
159 |
+
"rewards/accuracies": 0.5200001001358032,
|
160 |
+
"rewards/chosen": 0.024822045117616653,
|
161 |
+
"rewards/margins": 0.00336282467469573,
|
162 |
+
"rewards/rejected": 0.021459218114614487,
|
163 |
+
"step": 100
|
164 |
+
},
|
165 |
+
{
|
166 |
+
"epoch": 0.13,
|
167 |
+
"eval_logits/chosen": -1.6729556322097778,
|
168 |
+
"eval_logits/rejected": -1.6068017482757568,
|
169 |
+
"eval_logps/chosen": -2806.55517578125,
|
170 |
+
"eval_logps/rejected": -2491.901123046875,
|
171 |
+
"eval_loss": 19.51178741455078,
|
172 |
+
"eval_rewards/accuracies": 0.52734375,
|
173 |
+
"eval_rewards/chosen": 0.025559017434716225,
|
174 |
+
"eval_rewards/margins": 0.008243386633694172,
|
175 |
+
"eval_rewards/rejected": 0.017315629869699478,
|
176 |
+
"eval_runtime": 115.2508,
|
177 |
+
"eval_samples_per_second": 17.353,
|
178 |
+
"eval_steps_per_second": 0.278,
|
179 |
+
"step": 100
|
180 |
+
},
|
181 |
+
{
|
182 |
+
"epoch": 0.14,
|
183 |
+
"learning_rate": 4.971588128827782e-07,
|
184 |
+
"logits/chosen": -1.7473026514053345,
|
185 |
+
"logits/rejected": -1.6806236505508423,
|
186 |
+
"logps/chosen": -3125.757080078125,
|
187 |
+
"logps/rejected": -2645.337158203125,
|
188 |
+
"loss": 26.9149,
|
189 |
+
"rewards/accuracies": 0.6000000238418579,
|
190 |
+
"rewards/chosen": 0.016931097954511642,
|
191 |
+
"rewards/margins": 0.002864243695512414,
|
192 |
+
"rewards/rejected": 0.014066850766539574,
|
193 |
+
"step": 110
|
194 |
+
},
|
195 |
+
{
|
196 |
+
"epoch": 0.16,
|
197 |
+
"learning_rate": 4.951823705321981e-07,
|
198 |
+
"logits/chosen": -1.7069530487060547,
|
199 |
+
"logits/rejected": -1.6579583883285522,
|
200 |
+
"logps/chosen": -2828.78662109375,
|
201 |
+
"logps/rejected": -2442.76416015625,
|
202 |
+
"loss": 33.872,
|
203 |
+
"rewards/accuracies": 0.5600000023841858,
|
204 |
+
"rewards/chosen": 0.013961514458060265,
|
205 |
+
"rewards/margins": 0.00896529946476221,
|
206 |
+
"rewards/rejected": 0.004996216390281916,
|
207 |
+
"step": 120
|
208 |
+
},
|
209 |
+
{
|
210 |
+
"epoch": 0.17,
|
211 |
+
"learning_rate": 4.926933031274343e-07,
|
212 |
+
"logits/chosen": -1.7224699258804321,
|
213 |
+
"logits/rejected": -1.6934731006622314,
|
214 |
+
"logps/chosen": -2923.9306640625,
|
215 |
+
"logps/rejected": -2566.210693359375,
|
216 |
+
"loss": 39.0757,
|
217 |
+
"rewards/accuracies": 0.550000011920929,
|
218 |
+
"rewards/chosen": 0.038237668573856354,
|
219 |
+
"rewards/margins": 0.006029448006302118,
|
220 |
+
"rewards/rejected": 0.03220822289586067,
|
221 |
+
"step": 130
|
222 |
+
},
|
223 |
+
{
|
224 |
+
"epoch": 0.18,
|
225 |
+
"learning_rate": 4.896968147878145e-07,
|
226 |
+
"logits/chosen": -1.7280409336090088,
|
227 |
+
"logits/rejected": -1.7070726156234741,
|
228 |
+
"logps/chosen": -2737.75927734375,
|
229 |
+
"logps/rejected": -2486.45751953125,
|
230 |
+
"loss": 18.5231,
|
231 |
+
"rewards/accuracies": 0.6299999952316284,
|
232 |
+
"rewards/chosen": 0.031596291810274124,
|
233 |
+
"rewards/margins": 0.04216960817575455,
|
234 |
+
"rewards/rejected": -0.010573318228125572,
|
235 |
+
"step": 140
|
236 |
+
},
|
237 |
+
{
|
238 |
+
"epoch": 0.2,
|
239 |
+
"learning_rate": 4.861991705437081e-07,
|
240 |
+
"logits/chosen": -1.7859830856323242,
|
241 |
+
"logits/rejected": -1.7191492319107056,
|
242 |
+
"logps/chosen": -2743.43310546875,
|
243 |
+
"logps/rejected": -2297.162109375,
|
244 |
+
"loss": 20.7835,
|
245 |
+
"rewards/accuracies": 0.5800000429153442,
|
246 |
+
"rewards/chosen": 0.0336376316845417,
|
247 |
+
"rewards/margins": 0.011832155287265778,
|
248 |
+
"rewards/rejected": 0.021805476397275925,
|
249 |
+
"step": 150
|
250 |
+
},
|
251 |
+
{
|
252 |
+
"epoch": 0.21,
|
253 |
+
"learning_rate": 4.822076832376586e-07,
|
254 |
+
"logits/chosen": -1.8132251501083374,
|
255 |
+
"logits/rejected": -1.7665789127349854,
|
256 |
+
"logps/chosen": -2841.165771484375,
|
257 |
+
"logps/rejected": -2748.486572265625,
|
258 |
+
"loss": 57.9401,
|
259 |
+
"rewards/accuracies": 0.5099999904632568,
|
260 |
+
"rewards/chosen": 0.006118610501289368,
|
261 |
+
"rewards/margins": 0.0022155127953737974,
|
262 |
+
"rewards/rejected": 0.0039030970074236393,
|
263 |
+
"step": 160
|
264 |
+
},
|
265 |
+
{
|
266 |
+
"epoch": 0.22,
|
267 |
+
"learning_rate": 4.777306982347594e-07,
|
268 |
+
"logits/chosen": -1.6557657718658447,
|
269 |
+
"logits/rejected": -1.5996118783950806,
|
270 |
+
"logps/chosen": -3055.95361328125,
|
271 |
+
"logps/rejected": -2603.83642578125,
|
272 |
+
"loss": 23.1296,
|
273 |
+
"rewards/accuracies": 0.6200000047683716,
|
274 |
+
"rewards/chosen": 0.028251701965928078,
|
275 |
+
"rewards/margins": 0.020935241132974625,
|
276 |
+
"rewards/rejected": 0.007316464092582464,
|
277 |
+
"step": 170
|
278 |
+
},
|
279 |
+
{
|
280 |
+
"epoch": 0.24,
|
281 |
+
"learning_rate": 4.7277757597424075e-07,
|
282 |
+
"logits/chosen": -1.8335905075073242,
|
283 |
+
"logits/rejected": -1.7595329284667969,
|
284 |
+
"logps/chosen": -2963.73779296875,
|
285 |
+
"logps/rejected": -2540.163818359375,
|
286 |
+
"loss": 40.5046,
|
287 |
+
"rewards/accuracies": 0.5400000810623169,
|
288 |
+
"rewards/chosen": 0.018591446802020073,
|
289 |
+
"rewards/margins": -0.0024230503477156162,
|
290 |
+
"rewards/rejected": 0.02101449854671955,
|
291 |
+
"step": 180
|
292 |
+
},
|
293 |
+
{
|
294 |
+
"epoch": 0.25,
|
295 |
+
"learning_rate": 4.6735867239874904e-07,
|
296 |
+
"logits/chosen": -1.8637840747833252,
|
297 |
+
"logits/rejected": -1.7640159130096436,
|
298 |
+
"logps/chosen": -3237.434814453125,
|
299 |
+
"logps/rejected": -2429.197998046875,
|
300 |
+
"loss": 36.3042,
|
301 |
+
"rewards/accuracies": 0.6200000047683716,
|
302 |
+
"rewards/chosen": 0.04794805496931076,
|
303 |
+
"rewards/margins": 0.019117821007966995,
|
304 |
+
"rewards/rejected": 0.028830235823988914,
|
305 |
+
"step": 190
|
306 |
+
},
|
307 |
+
{
|
308 |
+
"epoch": 0.26,
|
309 |
+
"learning_rate": 4.6148531730223733e-07,
|
310 |
+
"logits/chosen": -1.6909841299057007,
|
311 |
+
"logits/rejected": -1.6915366649627686,
|
312 |
+
"logps/chosen": -2649.89404296875,
|
313 |
+
"logps/rejected": -2436.87353515625,
|
314 |
+
"loss": 28.1241,
|
315 |
+
"rewards/accuracies": 0.5300000309944153,
|
316 |
+
"rewards/chosen": 0.007661645300686359,
|
317 |
+
"rewards/margins": 0.0055509163066744804,
|
318 |
+
"rewards/rejected": 0.0021107294596731663,
|
319 |
+
"step": 200
|
320 |
+
},
|
321 |
+
{
|
322 |
+
"epoch": 0.26,
|
323 |
+
"eval_logits/chosen": -1.681164264678955,
|
324 |
+
"eval_logits/rejected": -1.618328332901001,
|
325 |
+
"eval_logps/chosen": -2808.258056640625,
|
326 |
+
"eval_logps/rejected": -2494.01953125,
|
327 |
+
"eval_loss": 32.517486572265625,
|
328 |
+
"eval_rewards/accuracies": 0.5234375,
|
329 |
+
"eval_rewards/chosen": 0.008527392521500587,
|
330 |
+
"eval_rewards/margins": 0.012391308322548866,
|
331 |
+
"eval_rewards/rejected": -0.0038639232516288757,
|
332 |
+
"eval_runtime": 113.682,
|
333 |
+
"eval_samples_per_second": 17.593,
|
334 |
+
"eval_steps_per_second": 0.281,
|
335 |
+
"step": 200
|
336 |
+
},
|
337 |
+
{
|
338 |
+
"epoch": 0.27,
|
339 |
+
"learning_rate": 4.5516979064173524e-07,
|
340 |
+
"logits/chosen": -1.749903917312622,
|
341 |
+
"logits/rejected": -1.7615283727645874,
|
342 |
+
"logps/chosen": -2285.7451171875,
|
343 |
+
"logps/rejected": -2269.229736328125,
|
344 |
+
"loss": 25.9535,
|
345 |
+
"rewards/accuracies": 0.6100000143051147,
|
346 |
+
"rewards/chosen": 0.011981850489974022,
|
347 |
+
"rewards/margins": 0.014764687046408653,
|
348 |
+
"rewards/rejected": -0.0027828349266201258,
|
349 |
+
"step": 210
|
350 |
+
},
|
351 |
+
{
|
352 |
+
"epoch": 0.29,
|
353 |
+
"learning_rate": 4.484252968625277e-07,
|
354 |
+
"logits/chosen": -1.716509222984314,
|
355 |
+
"logits/rejected": -1.6396989822387695,
|
356 |
+
"logps/chosen": -2435.95556640625,
|
357 |
+
"logps/rejected": -1922.770751953125,
|
358 |
+
"loss": 28.3739,
|
359 |
+
"rewards/accuracies": 0.6200000047683716,
|
360 |
+
"rewards/chosen": 0.004359879065304995,
|
361 |
+
"rewards/margins": 0.007711753249168396,
|
362 |
+
"rewards/rejected": -0.0033518739510327578,
|
363 |
+
"step": 220
|
364 |
+
},
|
365 |
+
{
|
366 |
+
"epoch": 0.3,
|
367 |
+
"learning_rate": 4.4126593729042193e-07,
|
368 |
+
"logits/chosen": -1.799469232559204,
|
369 |
+
"logits/rejected": -1.757004737854004,
|
370 |
+
"logps/chosen": -3254.6396484375,
|
371 |
+
"logps/rejected": -2515.59619140625,
|
372 |
+
"loss": 39.4707,
|
373 |
+
"rewards/accuracies": 0.5900000333786011,
|
374 |
+
"rewards/chosen": 0.03561704605817795,
|
375 |
+
"rewards/margins": 0.019830647855997086,
|
376 |
+
"rewards/rejected": 0.015786398202180862,
|
377 |
+
"step": 230
|
378 |
+
},
|
379 |
+
{
|
380 |
+
"epoch": 0.31,
|
381 |
+
"learning_rate": 4.3370668064882397e-07,
|
382 |
+
"logits/chosen": -1.7325947284698486,
|
383 |
+
"logits/rejected": -1.7474550008773804,
|
384 |
+
"logps/chosen": -2579.47412109375,
|
385 |
+
"logps/rejected": -2328.500732421875,
|
386 |
+
"loss": 44.2727,
|
387 |
+
"rewards/accuracies": 0.5100000500679016,
|
388 |
+
"rewards/chosen": 0.04269097000360489,
|
389 |
+
"rewards/margins": 0.02060030959546566,
|
390 |
+
"rewards/rejected": 0.02209065482020378,
|
391 |
+
"step": 240
|
392 |
+
},
|
393 |
+
{
|
394 |
+
"epoch": 0.33,
|
395 |
+
"learning_rate": 4.2576333176226944e-07,
|
396 |
+
"logits/chosen": -1.7366650104522705,
|
397 |
+
"logits/rejected": -1.706789255142212,
|
398 |
+
"logps/chosen": -2479.5576171875,
|
399 |
+
"logps/rejected": -2277.726318359375,
|
400 |
+
"loss": 29.5758,
|
401 |
+
"rewards/accuracies": 0.5300000309944153,
|
402 |
+
"rewards/chosen": 0.1058274507522583,
|
403 |
+
"rewards/margins": 0.013660475611686707,
|
404 |
+
"rewards/rejected": 0.0921669602394104,
|
405 |
+
"step": 250
|
406 |
+
},
|
407 |
+
{
|
408 |
+
"epoch": 0.34,
|
409 |
+
"learning_rate": 4.17452498511841e-07,
|
410 |
+
"logits/chosen": -1.7807962894439697,
|
411 |
+
"logits/rejected": -1.7134149074554443,
|
412 |
+
"logps/chosen": -2989.12841796875,
|
413 |
+
"logps/rejected": -2354.25830078125,
|
414 |
+
"loss": 38.7316,
|
415 |
+
"rewards/accuracies": 0.5200000405311584,
|
416 |
+
"rewards/chosen": 0.023859605193138123,
|
417 |
+
"rewards/margins": 0.005521018523722887,
|
418 |
+
"rewards/rejected": 0.018338587135076523,
|
419 |
+
"step": 260
|
420 |
+
},
|
421 |
+
{
|
422 |
+
"epoch": 0.35,
|
423 |
+
"learning_rate": 4.087915571115629e-07,
|
424 |
+
"logits/chosen": -1.8165556192398071,
|
425 |
+
"logits/rejected": -1.7687098979949951,
|
426 |
+
"logps/chosen": -2833.55859375,
|
427 |
+
"logps/rejected": -2183.32470703125,
|
428 |
+
"loss": 330.4642,
|
429 |
+
"rewards/accuracies": 0.5699999928474426,
|
430 |
+
"rewards/chosen": 0.031318746507167816,
|
431 |
+
"rewards/margins": 0.029996121302247047,
|
432 |
+
"rewards/rejected": 0.0013226259034126997,
|
433 |
+
"step": 270
|
434 |
+
},
|
435 |
+
{
|
436 |
+
"epoch": 0.37,
|
437 |
+
"learning_rate": 3.997986157783715e-07,
|
438 |
+
"logits/chosen": -1.6980018615722656,
|
439 |
+
"logits/rejected": -1.589050531387329,
|
440 |
+
"logps/chosen": -3510.792236328125,
|
441 |
+
"logps/rejected": -2689.208984375,
|
442 |
+
"loss": 58.1646,
|
443 |
+
"rewards/accuracies": 0.5200000405311584,
|
444 |
+
"rewards/chosen": 0.014776378870010376,
|
445 |
+
"rewards/margins": 0.011294273659586906,
|
446 |
+
"rewards/rejected": 0.0034821047447621822,
|
447 |
+
"step": 280
|
448 |
+
},
|
449 |
+
{
|
450 |
+
"epoch": 0.38,
|
451 |
+
"learning_rate": 3.9049247687162155e-07,
|
452 |
+
"logits/chosen": -1.7791646718978882,
|
453 |
+
"logits/rejected": -1.7399044036865234,
|
454 |
+
"logps/chosen": -2478.590576171875,
|
455 |
+
"logps/rejected": -2269.01416015625,
|
456 |
+
"loss": 31.6725,
|
457 |
+
"rewards/accuracies": 0.5699999928474426,
|
458 |
+
"rewards/chosen": 0.04884537309408188,
|
459 |
+
"rewards/margins": 0.0339895561337471,
|
460 |
+
"rewards/rejected": 0.014855814166367054,
|
461 |
+
"step": 290
|
462 |
+
},
|
463 |
+
{
|
464 |
+
"epoch": 0.39,
|
465 |
+
"learning_rate": 3.8089259758128543e-07,
|
466 |
+
"logits/chosen": -1.670789361000061,
|
467 |
+
"logits/rejected": -1.6030629873275757,
|
468 |
+
"logps/chosen": -2726.465576171875,
|
469 |
+
"logps/rejected": -2119.26123046875,
|
470 |
+
"loss": 84.7591,
|
471 |
+
"rewards/accuracies": 0.5699999928474426,
|
472 |
+
"rewards/chosen": 0.021672677248716354,
|
473 |
+
"rewards/margins": -0.010785548016428947,
|
474 |
+
"rewards/rejected": 0.03245822712779045,
|
475 |
+
"step": 300
|
476 |
+
},
|
477 |
+
{
|
478 |
+
"epoch": 0.39,
|
479 |
+
"eval_logits/chosen": -1.660080909729004,
|
480 |
+
"eval_logits/rejected": -1.596778154373169,
|
481 |
+
"eval_logps/chosen": -2806.140625,
|
482 |
+
"eval_logps/rejected": -2492.270263671875,
|
483 |
+
"eval_loss": 47.80431365966797,
|
484 |
+
"eval_rewards/accuracies": 0.5390625,
|
485 |
+
"eval_rewards/chosen": 0.029702020809054375,
|
486 |
+
"eval_rewards/margins": 0.01607733778655529,
|
487 |
+
"eval_rewards/rejected": 0.013624681159853935,
|
488 |
+
"eval_runtime": 116.3019,
|
489 |
+
"eval_samples_per_second": 17.197,
|
490 |
+
"eval_steps_per_second": 0.275,
|
491 |
+
"step": 300
|
492 |
+
},
|
493 |
+
{
|
494 |
+
"epoch": 0.41,
|
495 |
+
"learning_rate": 3.710190492470386e-07,
|
496 |
+
"logits/chosen": -1.6620228290557861,
|
497 |
+
"logits/rejected": -1.7311099767684937,
|
498 |
+
"logps/chosen": -2315.977294921875,
|
499 |
+
"logps/rejected": -2199.08251953125,
|
500 |
+
"loss": 43.6013,
|
501 |
+
"rewards/accuracies": 0.5400000214576721,
|
502 |
+
"rewards/chosen": 0.032384876161813736,
|
503 |
+
"rewards/margins": 0.008921505883336067,
|
504 |
+
"rewards/rejected": 0.02346337027847767,
|
505 |
+
"step": 310
|
506 |
+
},
|
507 |
+
{
|
508 |
+
"epoch": 0.42,
|
509 |
+
"learning_rate": 3.6089247539328616e-07,
|
510 |
+
"logits/chosen": -1.7675050497055054,
|
511 |
+
"logits/rejected": -1.7156997919082642,
|
512 |
+
"logps/chosen": -2859.810791015625,
|
513 |
+
"logps/rejected": -2569.75537109375,
|
514 |
+
"loss": 38.8904,
|
515 |
+
"rewards/accuracies": 0.559999942779541,
|
516 |
+
"rewards/chosen": 0.020630866289138794,
|
517 |
+
"rewards/margins": 0.0018306337296962738,
|
518 |
+
"rewards/rejected": 0.01880022883415222,
|
519 |
+
"step": 320
|
520 |
+
},
|
521 |
+
{
|
522 |
+
"epoch": 0.43,
|
523 |
+
"learning_rate": 3.5053404856787166e-07,
|
524 |
+
"logits/chosen": -1.6446609497070312,
|
525 |
+
"logits/rejected": -1.5918724536895752,
|
526 |
+
"logps/chosen": -3104.72802734375,
|
527 |
+
"logps/rejected": -2430.239013671875,
|
528 |
+
"loss": 84.9753,
|
529 |
+
"rewards/accuracies": 0.47999995946884155,
|
530 |
+
"rewards/chosen": 0.053660690784454346,
|
531 |
+
"rewards/margins": -0.005831834394484758,
|
532 |
+
"rewards/rejected": 0.05949252098798752,
|
533 |
+
"step": 330
|
534 |
+
},
|
535 |
+
{
|
536 |
+
"epoch": 0.44,
|
537 |
+
"learning_rate": 3.399654260747078e-07,
|
538 |
+
"logits/chosen": -1.699196219444275,
|
539 |
+
"logits/rejected": -1.7045748233795166,
|
540 |
+
"logps/chosen": -2584.699462890625,
|
541 |
+
"logps/rejected": -2263.678466796875,
|
542 |
+
"loss": 38.1532,
|
543 |
+
"rewards/accuracies": 0.5300000309944153,
|
544 |
+
"rewards/chosen": 0.02709970250725746,
|
545 |
+
"rewards/margins": 0.01412280835211277,
|
546 |
+
"rewards/rejected": 0.012976895086467266,
|
547 |
+
"step": 340
|
548 |
+
},
|
549 |
+
{
|
550 |
+
"epoch": 0.46,
|
551 |
+
"learning_rate": 3.2920870469288373e-07,
|
552 |
+
"logits/chosen": -1.7267532348632812,
|
553 |
+
"logits/rejected": -1.6659395694732666,
|
554 |
+
"logps/chosen": -2935.341796875,
|
555 |
+
"logps/rejected": -2503.583984375,
|
556 |
+
"loss": 47.1836,
|
557 |
+
"rewards/accuracies": 0.5199999809265137,
|
558 |
+
"rewards/chosen": 0.031215447932481766,
|
559 |
+
"rewards/margins": 0.022346725687384605,
|
560 |
+
"rewards/rejected": 0.008868719451129436,
|
561 |
+
"step": 350
|
562 |
+
},
|
563 |
+
{
|
564 |
+
"epoch": 0.47,
|
565 |
+
"learning_rate": 3.182863744769218e-07,
|
566 |
+
"logits/chosen": -1.7288787364959717,
|
567 |
+
"logits/rejected": -1.6928844451904297,
|
568 |
+
"logps/chosen": -2811.489501953125,
|
569 |
+
"logps/rejected": -2596.68310546875,
|
570 |
+
"loss": 36.8176,
|
571 |
+
"rewards/accuracies": 0.5099999904632568,
|
572 |
+
"rewards/chosen": 0.1375296413898468,
|
573 |
+
"rewards/margins": 0.0820910781621933,
|
574 |
+
"rewards/rejected": 0.05543852597475052,
|
575 |
+
"step": 360
|
576 |
+
},
|
577 |
+
{
|
578 |
+
"epoch": 0.48,
|
579 |
+
"learning_rate": 3.072212717347776e-07,
|
580 |
+
"logits/chosen": -1.7680120468139648,
|
581 |
+
"logits/rejected": -1.6781940460205078,
|
582 |
+
"logps/chosen": -3101.98583984375,
|
583 |
+
"logps/rejected": -2426.4716796875,
|
584 |
+
"loss": 36.7837,
|
585 |
+
"rewards/accuracies": 0.5199999809265137,
|
586 |
+
"rewards/chosen": 0.022122934460639954,
|
587 |
+
"rewards/margins": 0.011781491339206696,
|
588 |
+
"rewards/rejected": 0.010341441258788109,
|
589 |
+
"step": 370
|
590 |
+
},
|
591 |
+
{
|
592 |
+
"epoch": 0.5,
|
593 |
+
"learning_rate": 2.9603653128189665e-07,
|
594 |
+
"logits/chosen": -1.6812299489974976,
|
595 |
+
"logits/rejected": -1.7215496301651,
|
596 |
+
"logps/chosen": -2823.8291015625,
|
597 |
+
"logps/rejected": -2762.53076171875,
|
598 |
+
"loss": 42.732,
|
599 |
+
"rewards/accuracies": 0.5,
|
600 |
+
"rewards/chosen": 0.028385426849126816,
|
601 |
+
"rewards/margins": -0.006515379063785076,
|
602 |
+
"rewards/rejected": 0.03490080684423447,
|
603 |
+
"step": 380
|
604 |
+
},
|
605 |
+
{
|
606 |
+
"epoch": 0.51,
|
607 |
+
"learning_rate": 2.8475553807115387e-07,
|
608 |
+
"logits/chosen": -1.8070951700210571,
|
609 |
+
"logits/rejected": -1.7426990270614624,
|
610 |
+
"logps/chosen": -2697.833251953125,
|
611 |
+
"logps/rejected": -2263.9990234375,
|
612 |
+
"loss": 55.8683,
|
613 |
+
"rewards/accuracies": 0.5099999904632568,
|
614 |
+
"rewards/chosen": 0.012206131592392921,
|
615 |
+
"rewards/margins": 0.011461116373538971,
|
616 |
+
"rewards/rejected": 0.0007450145785696805,
|
617 |
+
"step": 390
|
618 |
+
},
|
619 |
+
{
|
620 |
+
"epoch": 0.52,
|
621 |
+
"learning_rate": 2.7340187829980883e-07,
|
622 |
+
"logits/chosen": -1.8249183893203735,
|
623 |
+
"logits/rejected": -1.7130759954452515,
|
624 |
+
"logps/chosen": -2940.11181640625,
|
625 |
+
"logps/rejected": -2463.068359375,
|
626 |
+
"loss": 40.7835,
|
627 |
+
"rewards/accuracies": 0.6000000238418579,
|
628 |
+
"rewards/chosen": 0.0059137181378901005,
|
629 |
+
"rewards/margins": 0.01795141212642193,
|
630 |
+
"rewards/rejected": -0.012037692591547966,
|
631 |
+
"step": 400
|
632 |
+
},
|
633 |
+
{
|
634 |
+
"epoch": 0.52,
|
635 |
+
"eval_logits/chosen": -1.6917269229888916,
|
636 |
+
"eval_logits/rejected": -1.628839373588562,
|
637 |
+
"eval_logps/chosen": -2807.42626953125,
|
638 |
+
"eval_logps/rejected": -2493.92041015625,
|
639 |
+
"eval_loss": 30.672218322753906,
|
640 |
+
"eval_rewards/accuracies": 0.5546875,
|
641 |
+
"eval_rewards/chosen": 0.016848012804985046,
|
642 |
+
"eval_rewards/margins": 0.019721925258636475,
|
643 |
+
"eval_rewards/rejected": -0.0028739143162965775,
|
644 |
+
"eval_runtime": 110.0303,
|
645 |
+
"eval_samples_per_second": 18.177,
|
646 |
+
"eval_steps_per_second": 0.291,
|
647 |
+
"step": 400
|
648 |
+
},
|
649 |
+
{
|
650 |
+
"epoch": 0.54,
|
651 |
+
"learning_rate": 2.6199929009569996e-07,
|
652 |
+
"logits/chosen": -1.7034717798233032,
|
653 |
+
"logits/rejected": -1.707564353942871,
|
654 |
+
"logps/chosen": -2599.38330078125,
|
655 |
+
"logps/rejected": -2273.864990234375,
|
656 |
+
"loss": 43.9981,
|
657 |
+
"rewards/accuracies": 0.5600000023841858,
|
658 |
+
"rewards/chosen": 0.02160579524934292,
|
659 |
+
"rewards/margins": 0.0038177832029759884,
|
660 |
+
"rewards/rejected": 0.017788011580705643,
|
661 |
+
"step": 410
|
662 |
+
},
|
663 |
+
{
|
664 |
+
"epoch": 0.55,
|
665 |
+
"learning_rate": 2.5057161388578505e-07,
|
666 |
+
"logits/chosen": -1.7964134216308594,
|
667 |
+
"logits/rejected": -1.730661392211914,
|
668 |
+
"logps/chosen": -3038.08740234375,
|
669 |
+
"logps/rejected": -2405.333740234375,
|
670 |
+
"loss": 31.4477,
|
671 |
+
"rewards/accuracies": 0.5600000619888306,
|
672 |
+
"rewards/chosen": 0.05013390630483627,
|
673 |
+
"rewards/margins": 0.029845798388123512,
|
674 |
+
"rewards/rejected": 0.02028810977935791,
|
675 |
+
"step": 420
|
676 |
+
},
|
677 |
+
{
|
678 |
+
"epoch": 0.56,
|
679 |
+
"learning_rate": 2.391427425507943e-07,
|
680 |
+
"logits/chosen": -1.6959331035614014,
|
681 |
+
"logits/rejected": -1.6784296035766602,
|
682 |
+
"logps/chosen": -2696.2236328125,
|
683 |
+
"logps/rejected": -2173.48583984375,
|
684 |
+
"loss": 32.2174,
|
685 |
+
"rewards/accuracies": 0.5600000619888306,
|
686 |
+
"rewards/chosen": 0.01727980561554432,
|
687 |
+
"rewards/margins": 0.013602805323898792,
|
688 |
+
"rewards/rejected": 0.0036770000588148832,
|
689 |
+
"step": 430
|
690 |
+
},
|
691 |
+
{
|
692 |
+
"epoch": 0.58,
|
693 |
+
"learning_rate": 2.2773657147021465e-07,
|
694 |
+
"logits/chosen": -1.8469693660736084,
|
695 |
+
"logits/rejected": -1.7459551095962524,
|
696 |
+
"logps/chosen": -3117.762451171875,
|
697 |
+
"logps/rejected": -2390.564208984375,
|
698 |
+
"loss": 37.6526,
|
699 |
+
"rewards/accuracies": 0.5,
|
700 |
+
"rewards/chosen": 0.01079155970364809,
|
701 |
+
"rewards/margins": 0.011436818167567253,
|
702 |
+
"rewards/rejected": -0.00064525764901191,
|
703 |
+
"step": 440
|
704 |
+
},
|
705 |
+
{
|
706 |
+
"epoch": 0.59,
|
707 |
+
"learning_rate": 2.1637694856204885e-07,
|
708 |
+
"logits/chosen": -1.751587152481079,
|
709 |
+
"logits/rejected": -1.6395552158355713,
|
710 |
+
"logps/chosen": -2887.770751953125,
|
711 |
+
"logps/rejected": -2129.771728515625,
|
712 |
+
"loss": 53.6906,
|
713 |
+
"rewards/accuracies": 0.550000011920929,
|
714 |
+
"rewards/chosen": 0.004514098167419434,
|
715 |
+
"rewards/margins": 0.00042482782737351954,
|
716 |
+
"rewards/rejected": 0.004089272115379572,
|
717 |
+
"step": 450
|
718 |
+
},
|
719 |
+
{
|
720 |
+
"epoch": 0.6,
|
721 |
+
"learning_rate": 2.0508762442180743e-07,
|
722 |
+
"logits/chosen": -1.8443762063980103,
|
723 |
+
"logits/rejected": -1.792295217514038,
|
724 |
+
"logps/chosen": -2964.06494140625,
|
725 |
+
"logps/rejected": -2577.50244140625,
|
726 |
+
"loss": 62.4137,
|
727 |
+
"rewards/accuracies": 0.5600000023841858,
|
728 |
+
"rewards/chosen": 0.04290894791483879,
|
729 |
+
"rewards/margins": 0.01085699163377285,
|
730 |
+
"rewards/rejected": 0.03205195814371109,
|
731 |
+
"step": 460
|
732 |
+
},
|
733 |
+
{
|
734 |
+
"epoch": 0.61,
|
735 |
+
"learning_rate": 1.93892202664981e-07,
|
736 |
+
"logits/chosen": -1.6403262615203857,
|
737 |
+
"logits/rejected": -1.712969183921814,
|
738 |
+
"logps/chosen": -2689.706787109375,
|
739 |
+
"logps/rejected": -2513.2998046875,
|
740 |
+
"loss": 31.7885,
|
741 |
+
"rewards/accuracies": 0.5100000500679016,
|
742 |
+
"rewards/chosen": 0.01223880797624588,
|
743 |
+
"rewards/margins": 0.011182873509824276,
|
744 |
+
"rewards/rejected": 0.0010559323709458113,
|
745 |
+
"step": 470
|
746 |
+
},
|
747 |
+
{
|
748 |
+
"epoch": 0.63,
|
749 |
+
"learning_rate": 1.8281409057681686e-07,
|
750 |
+
"logits/chosen": -1.651449203491211,
|
751 |
+
"logits/rejected": -1.5920675992965698,
|
752 |
+
"logps/chosen": -3211.50341796875,
|
753 |
+
"logps/rejected": -2753.0322265625,
|
754 |
+
"loss": 103.2519,
|
755 |
+
"rewards/accuracies": 0.550000011920929,
|
756 |
+
"rewards/chosen": 0.0340498685836792,
|
757 |
+
"rewards/margins": 0.005449384916573763,
|
758 |
+
"rewards/rejected": 0.028600484132766724,
|
759 |
+
"step": 480
|
760 |
+
},
|
761 |
+
{
|
762 |
+
"epoch": 0.64,
|
763 |
+
"learning_rate": 1.7187645017258195e-07,
|
764 |
+
"logits/chosen": -1.823428750038147,
|
765 |
+
"logits/rejected": -1.7740917205810547,
|
766 |
+
"logps/chosen": -2745.991455078125,
|
767 |
+
"logps/rejected": -2407.27978515625,
|
768 |
+
"loss": 48.2582,
|
769 |
+
"rewards/accuracies": 0.5300000309944153,
|
770 |
+
"rewards/chosen": 0.03057839907705784,
|
771 |
+
"rewards/margins": 0.003420495195314288,
|
772 |
+
"rewards/rejected": 0.027157902717590332,
|
773 |
+
"step": 490
|
774 |
+
},
|
775 |
+
{
|
776 |
+
"epoch": 0.65,
|
777 |
+
"learning_rate": 1.6110214977063343e-07,
|
778 |
+
"logits/chosen": -1.7967636585235596,
|
779 |
+
"logits/rejected": -1.7410199642181396,
|
780 |
+
"logps/chosen": -2905.251708984375,
|
781 |
+
"logps/rejected": -2435.401611328125,
|
782 |
+
"loss": 36.2204,
|
783 |
+
"rewards/accuracies": 0.5,
|
784 |
+
"rewards/chosen": 0.013903191313147545,
|
785 |
+
"rewards/margins": 0.00013892585411667824,
|
786 |
+
"rewards/rejected": 0.013764267787337303,
|
787 |
+
"step": 500
|
788 |
+
},
|
789 |
+
{
|
790 |
+
"epoch": 0.65,
|
791 |
+
"eval_logits/chosen": -1.6842743158340454,
|
792 |
+
"eval_logits/rejected": -1.6236169338226318,
|
793 |
+
"eval_logps/chosen": -2806.076171875,
|
794 |
+
"eval_logps/rejected": -2491.544677734375,
|
795 |
+
"eval_loss": 31.220157623291016,
|
796 |
+
"eval_rewards/accuracies": 0.53515625,
|
797 |
+
"eval_rewards/chosen": 0.030346479266881943,
|
798 |
+
"eval_rewards/margins": 0.009465347044169903,
|
799 |
+
"eval_rewards/rejected": 0.020881133154034615,
|
800 |
+
"eval_runtime": 112.3374,
|
801 |
+
"eval_samples_per_second": 17.804,
|
802 |
+
"eval_steps_per_second": 0.285,
|
803 |
+
"step": 500
|
804 |
+
},
|
805 |
+
{
|
806 |
+
"epoch": 0.67,
|
807 |
+
"learning_rate": 1.5051371617954777e-07,
|
808 |
+
"logits/chosen": -1.6810442209243774,
|
809 |
+
"logits/rejected": -1.6596931219100952,
|
810 |
+
"logps/chosen": -2559.396728515625,
|
811 |
+
"logps/rejected": -2228.120361328125,
|
812 |
+
"loss": 44.2046,
|
813 |
+
"rewards/accuracies": 0.5399999618530273,
|
814 |
+
"rewards/chosen": 0.016220757737755775,
|
815 |
+
"rewards/margins": 0.007862111553549767,
|
816 |
+
"rewards/rejected": 0.00835864432156086,
|
817 |
+
"step": 510
|
818 |
+
},
|
819 |
+
{
|
820 |
+
"epoch": 0.68,
|
821 |
+
"learning_rate": 1.4013328759927622e-07,
|
822 |
+
"logits/chosen": -1.6315361261367798,
|
823 |
+
"logits/rejected": -1.6191142797470093,
|
824 |
+
"logps/chosen": -2893.280029296875,
|
825 |
+
"logps/rejected": -2805.344970703125,
|
826 |
+
"loss": 31.2508,
|
827 |
+
"rewards/accuracies": 0.6299999952316284,
|
828 |
+
"rewards/chosen": 0.02805119752883911,
|
829 |
+
"rewards/margins": 0.01223050244152546,
|
830 |
+
"rewards/rejected": 0.0158206969499588,
|
831 |
+
"step": 520
|
832 |
+
},
|
833 |
+
{
|
834 |
+
"epoch": 0.69,
|
835 |
+
"learning_rate": 1.2998256733479896e-07,
|
836 |
+
"logits/chosen": -1.810739278793335,
|
837 |
+
"logits/rejected": -1.8173195123672485,
|
838 |
+
"logps/chosen": -2332.383056640625,
|
839 |
+
"logps/rejected": -1922.5443115234375,
|
840 |
+
"loss": 226.0483,
|
841 |
+
"rewards/accuracies": 0.5600000023841858,
|
842 |
+
"rewards/chosen": 0.020228227600455284,
|
843 |
+
"rewards/margins": 0.009395391680300236,
|
844 |
+
"rewards/rejected": 0.010832836851477623,
|
845 |
+
"step": 530
|
846 |
+
},
|
847 |
+
{
|
848 |
+
"epoch": 0.71,
|
849 |
+
"learning_rate": 1.200827784190537e-07,
|
850 |
+
"logits/chosen": -1.6795597076416016,
|
851 |
+
"logits/rejected": -1.6883628368377686,
|
852 |
+
"logps/chosen": -3027.91796875,
|
853 |
+
"logps/rejected": -2619.313232421875,
|
854 |
+
"loss": 29.3654,
|
855 |
+
"rewards/accuracies": 0.5600000619888306,
|
856 |
+
"rewards/chosen": 0.01968817412853241,
|
857 |
+
"rewards/margins": 0.008831174112856388,
|
858 |
+
"rewards/rejected": 0.010857000946998596,
|
859 |
+
"step": 540
|
860 |
+
},
|
861 |
+
{
|
862 |
+
"epoch": 0.72,
|
863 |
+
"learning_rate": 1.1045461924001323e-07,
|
864 |
+
"logits/chosen": -1.791738748550415,
|
865 |
+
"logits/rejected": -1.8031442165374756,
|
866 |
+
"logps/chosen": -2852.6904296875,
|
867 |
+
"logps/rejected": -2462.853271484375,
|
868 |
+
"loss": 45.3966,
|
869 |
+
"rewards/accuracies": 0.46000003814697266,
|
870 |
+
"rewards/chosen": 0.010838394984602928,
|
871 |
+
"rewards/margins": 0.003685446921736002,
|
872 |
+
"rewards/rejected": 0.007152946200221777,
|
873 |
+
"step": 550
|
874 |
+
},
|
875 |
+
{
|
876 |
+
"epoch": 0.73,
|
877 |
+
"learning_rate": 1.0111822026468514e-07,
|
878 |
+
"logits/chosen": -1.7872514724731445,
|
879 |
+
"logits/rejected": -1.658860445022583,
|
880 |
+
"logps/chosen": -2903.530029296875,
|
881 |
+
"logps/rejected": -2319.64599609375,
|
882 |
+
"loss": 67.4473,
|
883 |
+
"rewards/accuracies": 0.5700000524520874,
|
884 |
+
"rewards/chosen": 0.009608490392565727,
|
885 |
+
"rewards/margins": 0.004570655524730682,
|
886 |
+
"rewards/rejected": 0.0050378344021737576,
|
887 |
+
"step": 560
|
888 |
+
},
|
889 |
+
{
|
890 |
+
"epoch": 0.75,
|
891 |
+
"learning_rate": 9.209310195051581e-08,
|
892 |
+
"logits/chosen": -1.8252109289169312,
|
893 |
+
"logits/rejected": -1.6855742931365967,
|
894 |
+
"logps/chosen": -2538.860107421875,
|
895 |
+
"logps/rejected": -1955.6048583984375,
|
896 |
+
"loss": 63.0174,
|
897 |
+
"rewards/accuracies": 0.6299999952316284,
|
898 |
+
"rewards/chosen": 0.04829864576458931,
|
899 |
+
"rewards/margins": 0.022980675101280212,
|
900 |
+
"rewards/rejected": 0.025317972525954247,
|
901 |
+
"step": 570
|
902 |
+
},
|
903 |
+
{
|
904 |
+
"epoch": 0.76,
|
905 |
+
"learning_rate": 8.339813393219713e-08,
|
906 |
+
"logits/chosen": -1.739793062210083,
|
907 |
+
"logits/rejected": -1.641005516052246,
|
908 |
+
"logps/chosen": -2791.561767578125,
|
909 |
+
"logps/rejected": -2475.72998046875,
|
910 |
+
"loss": 59.8369,
|
911 |
+
"rewards/accuracies": 0.5699999928474426,
|
912 |
+
"rewards/chosen": 0.05231914669275284,
|
913 |
+
"rewards/margins": 0.021858692169189453,
|
914 |
+
"rewards/rejected": 0.030460450798273087,
|
915 |
+
"step": 580
|
916 |
+
},
|
917 |
+
{
|
918 |
+
"epoch": 0.77,
|
919 |
+
"learning_rate": 7.505149556920698e-08,
|
920 |
+
"logits/chosen": -1.8431494235992432,
|
921 |
+
"logits/rejected": -1.7774893045425415,
|
922 |
+
"logps/chosen": -2542.13427734375,
|
923 |
+
"logps/rejected": -2193.825927734375,
|
924 |
+
"loss": 29.3999,
|
925 |
+
"rewards/accuracies": 0.5800000429153442,
|
926 |
+
"rewards/chosen": 0.04752471297979355,
|
927 |
+
"rewards/margins": 0.017444033175706863,
|
928 |
+
"rewards/rejected": 0.030080681666731834,
|
929 |
+
"step": 590
|
930 |
+
},
|
931 |
+
{
|
932 |
+
"epoch": 0.78,
|
933 |
+
"learning_rate": 6.707063793657064e-08,
|
934 |
+
"logits/chosen": -1.7773969173431396,
|
935 |
+
"logits/rejected": -1.6891686916351318,
|
936 |
+
"logps/chosen": -2942.21240234375,
|
937 |
+
"logps/rejected": -2429.352294921875,
|
938 |
+
"loss": 99.7738,
|
939 |
+
"rewards/accuracies": 0.6200000047683716,
|
940 |
+
"rewards/chosen": 0.03306427597999573,
|
941 |
+
"rewards/margins": 0.01405587512999773,
|
942 |
+
"rewards/rejected": 0.019008399918675423,
|
943 |
+
"step": 600
|
944 |
+
},
|
945 |
+
{
|
946 |
+
"epoch": 0.78,
|
947 |
+
"eval_logits/chosen": -1.6827195882797241,
|
948 |
+
"eval_logits/rejected": -1.6222153902053833,
|
949 |
+
"eval_logps/chosen": -2804.348388671875,
|
950 |
+
"eval_logps/rejected": -2489.908935546875,
|
951 |
+
"eval_loss": 33.74028778076172,
|
952 |
+
"eval_rewards/accuracies": 0.5390625,
|
953 |
+
"eval_rewards/chosen": 0.04762275516986847,
|
954 |
+
"eval_rewards/margins": 0.010385587811470032,
|
955 |
+
"eval_rewards/rejected": 0.037237171083688736,
|
956 |
+
"eval_runtime": 106.3716,
|
957 |
+
"eval_samples_per_second": 18.802,
|
958 |
+
"eval_steps_per_second": 0.301,
|
959 |
+
"step": 600
|
960 |
+
},
|
961 |
+
{
|
962 |
+
"epoch": 0.8,
|
963 |
+
"learning_rate": 5.947224733831363e-08,
|
964 |
+
"logits/chosen": -1.759399175643921,
|
965 |
+
"logits/rejected": -1.7431520223617554,
|
966 |
+
"logps/chosen": -2756.701416015625,
|
967 |
+
"logps/rejected": -2470.905029296875,
|
968 |
+
"loss": 51.5387,
|
969 |
+
"rewards/accuracies": 0.5199999809265137,
|
970 |
+
"rewards/chosen": 0.011415710672736168,
|
971 |
+
"rewards/margins": 0.009652274660766125,
|
972 |
+
"rewards/rejected": 0.0017634350806474686,
|
973 |
+
"step": 610
|
974 |
+
},
|
975 |
+
{
|
976 |
+
"epoch": 0.81,
|
977 |
+
"learning_rate": 5.227221041988955e-08,
|
978 |
+
"logits/chosen": -1.7857062816619873,
|
979 |
+
"logits/rejected": -1.725630760192871,
|
980 |
+
"logps/chosen": -2520.410400390625,
|
981 |
+
"logps/rejected": -2319.78564453125,
|
982 |
+
"loss": 28.3912,
|
983 |
+
"rewards/accuracies": 0.5900000333786011,
|
984 |
+
"rewards/chosen": 0.01811736635863781,
|
985 |
+
"rewards/margins": 0.01297797542065382,
|
986 |
+
"rewards/rejected": 0.005139390472322702,
|
987 |
+
"step": 620
|
988 |
+
},
|
989 |
+
{
|
990 |
+
"epoch": 0.82,
|
991 |
+
"learning_rate": 4.548558095252758e-08,
|
992 |
+
"logits/chosen": -1.6374757289886475,
|
993 |
+
"logits/rejected": -1.673044204711914,
|
994 |
+
"logps/chosen": -2845.2119140625,
|
995 |
+
"logps/rejected": -2698.294677734375,
|
996 |
+
"loss": 42.0619,
|
997 |
+
"rewards/accuracies": 0.48000001907348633,
|
998 |
+
"rewards/chosen": 0.030720695853233337,
|
999 |
+
"rewards/margins": 0.020541973412036896,
|
1000 |
+
"rewards/rejected": 0.010178723372519016,
|
1001 |
+
"step": 630
|
1002 |
+
},
|
1003 |
+
{
|
1004 |
+
"epoch": 0.84,
|
1005 |
+
"learning_rate": 3.9126548358945635e-08,
|
1006 |
+
"logits/chosen": -1.7063062191009521,
|
1007 |
+
"logits/rejected": -1.6988853216171265,
|
1008 |
+
"logps/chosen": -3136.520263671875,
|
1009 |
+
"logps/rejected": -2731.25927734375,
|
1010 |
+
"loss": 46.0608,
|
1011 |
+
"rewards/accuracies": 0.5600000619888306,
|
1012 |
+
"rewards/chosen": 0.029350021854043007,
|
1013 |
+
"rewards/margins": 0.010425332933664322,
|
1014 |
+
"rewards/rejected": 0.018924688920378685,
|
1015 |
+
"step": 640
|
1016 |
+
},
|
1017 |
+
{
|
1018 |
+
"epoch": 0.85,
|
1019 |
+
"learning_rate": 3.3208408046234896e-08,
|
1020 |
+
"logits/chosen": -1.8164535760879517,
|
1021 |
+
"logits/rejected": -1.7656440734863281,
|
1022 |
+
"logps/chosen": -2538.8046875,
|
1023 |
+
"logps/rejected": -2061.81591796875,
|
1024 |
+
"loss": 40.0838,
|
1025 |
+
"rewards/accuracies": 0.550000011920929,
|
1026 |
+
"rewards/chosen": 0.01678399369120598,
|
1027 |
+
"rewards/margins": 0.009666666388511658,
|
1028 |
+
"rewards/rejected": 0.007117328234016895,
|
1029 |
+
"step": 650
|
1030 |
+
},
|
1031 |
+
{
|
1032 |
+
"epoch": 0.86,
|
1033 |
+
"learning_rate": 2.774353360794493e-08,
|
1034 |
+
"logits/chosen": -1.7155154943466187,
|
1035 |
+
"logits/rejected": -1.7442939281463623,
|
1036 |
+
"logps/chosen": -2761.740966796875,
|
1037 |
+
"logps/rejected": -2534.80419921875,
|
1038 |
+
"loss": 36.8374,
|
1039 |
+
"rewards/accuracies": 0.64000004529953,
|
1040 |
+
"rewards/chosen": 0.03588343411684036,
|
1041 |
+
"rewards/margins": 0.037469957023859024,
|
1042 |
+
"rewards/rejected": -0.0015865217428654432,
|
1043 |
+
"step": 660
|
1044 |
+
},
|
1045 |
+
{
|
1046 |
+
"epoch": 0.88,
|
1047 |
+
"learning_rate": 2.2743350953487422e-08,
|
1048 |
+
"logits/chosen": -1.6992709636688232,
|
1049 |
+
"logits/rejected": -1.7416222095489502,
|
1050 |
+
"logps/chosen": -2850.97705078125,
|
1051 |
+
"logps/rejected": -2569.76611328125,
|
1052 |
+
"loss": 86.4259,
|
1053 |
+
"rewards/accuracies": 0.5300000905990601,
|
1054 |
+
"rewards/chosen": 0.018378589302301407,
|
1055 |
+
"rewards/margins": 0.004103804472833872,
|
1056 |
+
"rewards/rejected": 0.014274786226451397,
|
1057 |
+
"step": 670
|
1058 |
+
},
|
1059 |
+
{
|
1060 |
+
"epoch": 0.89,
|
1061 |
+
"learning_rate": 1.8218314418949387e-08,
|
1062 |
+
"logits/chosen": -1.718764305114746,
|
1063 |
+
"logits/rejected": -1.6741740703582764,
|
1064 |
+
"logps/chosen": -2353.093017578125,
|
1065 |
+
"logps/rejected": -2190.77001953125,
|
1066 |
+
"loss": 46.1473,
|
1067 |
+
"rewards/accuracies": 0.5699999928474426,
|
1068 |
+
"rewards/chosen": 0.0031641994137316942,
|
1069 |
+
"rewards/margins": 0.0004996396601200104,
|
1070 |
+
"rewards/rejected": 0.002664559753611684,
|
1071 |
+
"step": 680
|
1072 |
+
},
|
1073 |
+
{
|
1074 |
+
"epoch": 0.9,
|
1075 |
+
"learning_rate": 1.4177884909263277e-08,
|
1076 |
+
"logits/chosen": -1.6867101192474365,
|
1077 |
+
"logits/rejected": -1.652515172958374,
|
1078 |
+
"logps/chosen": -2937.97412109375,
|
1079 |
+
"logps/rejected": -2552.07177734375,
|
1080 |
+
"loss": 37.0029,
|
1081 |
+
"rewards/accuracies": 0.5199999809265137,
|
1082 |
+
"rewards/chosen": 0.007288885302841663,
|
1083 |
+
"rewards/margins": -0.0001541988895041868,
|
1084 |
+
"rewards/rejected": 0.007443083915859461,
|
1085 |
+
"step": 690
|
1086 |
+
},
|
1087 |
+
{
|
1088 |
+
"epoch": 0.92,
|
1089 |
+
"learning_rate": 1.063051011743335e-08,
|
1090 |
+
"logits/chosen": -1.7554800510406494,
|
1091 |
+
"logits/rejected": -1.7419729232788086,
|
1092 |
+
"logps/chosen": -2755.109619140625,
|
1093 |
+
"logps/rejected": -2368.246337890625,
|
1094 |
+
"loss": 41.8506,
|
1095 |
+
"rewards/accuracies": 0.46000003814697266,
|
1096 |
+
"rewards/chosen": 0.006798497401177883,
|
1097 |
+
"rewards/margins": 0.010020612739026546,
|
1098 |
+
"rewards/rejected": -0.0032221146393567324,
|
1099 |
+
"step": 700
|
1100 |
+
},
|
1101 |
+
{
|
1102 |
+
"epoch": 0.92,
|
1103 |
+
"eval_logits/chosen": -1.682308554649353,
|
1104 |
+
"eval_logits/rejected": -1.6210675239562988,
|
1105 |
+
"eval_logps/chosen": -2806.1005859375,
|
1106 |
+
"eval_logps/rejected": -2491.68505859375,
|
1107 |
+
"eval_loss": 32.91334915161133,
|
1108 |
+
"eval_rewards/accuracies": 0.5546875,
|
1109 |
+
"eval_rewards/chosen": 0.030103469267487526,
|
1110 |
+
"eval_rewards/margins": 0.01062812004238367,
|
1111 |
+
"eval_rewards/rejected": 0.01947534643113613,
|
1112 |
+
"eval_runtime": 110.9725,
|
1113 |
+
"eval_samples_per_second": 18.022,
|
1114 |
+
"eval_steps_per_second": 0.288,
|
1115 |
+
"step": 700
|
1116 |
+
},
|
1117 |
+
{
|
1118 |
+
"epoch": 0.93,
|
1119 |
+
"learning_rate": 7.58360686217671e-09,
|
1120 |
+
"logits/chosen": -1.7843902111053467,
|
1121 |
+
"logits/rejected": -1.6857761144638062,
|
1122 |
+
"logps/chosen": -2821.310546875,
|
1123 |
+
"logps/rejected": -2445.586669921875,
|
1124 |
+
"loss": 44.0616,
|
1125 |
+
"rewards/accuracies": 0.6000000238418579,
|
1126 |
+
"rewards/chosen": 0.025277357548475266,
|
1127 |
+
"rewards/margins": 0.014521745964884758,
|
1128 |
+
"rewards/rejected": 0.010755611583590508,
|
1129 |
+
"step": 710
|
1130 |
+
},
|
1131 |
+
{
|
1132 |
+
"epoch": 0.94,
|
1133 |
+
"learning_rate": 5.043545580906694e-09,
|
1134 |
+
"logits/chosen": -1.7102206945419312,
|
1135 |
+
"logits/rejected": -1.6009165048599243,
|
1136 |
+
"logps/chosen": -2682.336669921875,
|
1137 |
+
"logps/rejected": -2234.36279296875,
|
1138 |
+
"loss": 44.9558,
|
1139 |
+
"rewards/accuracies": 0.6299999952316284,
|
1140 |
+
"rewards/chosen": 0.018401915207505226,
|
1141 |
+
"rewards/margins": 0.030992329120635986,
|
1142 |
+
"rewards/rejected": -0.012590417638421059,
|
1143 |
+
"step": 720
|
1144 |
+
},
|
1145 |
+
{
|
1146 |
+
"epoch": 0.95,
|
1147 |
+
"learning_rate": 3.015637010480576e-09,
|
1148 |
+
"logits/chosen": -1.7701480388641357,
|
1149 |
+
"logits/rejected": -1.7436597347259521,
|
1150 |
+
"logps/chosen": -3042.88330078125,
|
1151 |
+
"logps/rejected": -2501.55615234375,
|
1152 |
+
"loss": 35.3819,
|
1153 |
+
"rewards/accuracies": 0.5199999809265137,
|
1154 |
+
"rewards/chosen": 0.012798592448234558,
|
1155 |
+
"rewards/margins": -0.0020437492057681084,
|
1156 |
+
"rewards/rejected": 0.014842341654002666,
|
1157 |
+
"step": 730
|
1158 |
+
},
|
1159 |
+
{
|
1160 |
+
"epoch": 0.97,
|
1161 |
+
"learning_rate": 1.5041210835596285e-09,
|
1162 |
+
"logits/chosen": -1.703537940979004,
|
1163 |
+
"logits/rejected": -1.6897165775299072,
|
1164 |
+
"logps/chosen": -2817.1484375,
|
1165 |
+
"logps/rejected": -2390.23095703125,
|
1166 |
+
"loss": 55.7217,
|
1167 |
+
"rewards/accuracies": 0.5800000429153442,
|
1168 |
+
"rewards/chosen": 0.022753870114684105,
|
1169 |
+
"rewards/margins": 0.017634030431509018,
|
1170 |
+
"rewards/rejected": 0.005119838751852512,
|
1171 |
+
"step": 740
|
1172 |
+
},
|
1173 |
+
{
|
1174 |
+
"epoch": 0.98,
|
1175 |
+
"learning_rate": 5.121580637968137e-10,
|
1176 |
+
"logits/chosen": -1.7322509288787842,
|
1177 |
+
"logits/rejected": -1.6345192193984985,
|
1178 |
+
"logps/chosen": -2836.63623046875,
|
1179 |
+
"logps/rejected": -2363.93505859375,
|
1180 |
+
"loss": 67.2692,
|
1181 |
+
"rewards/accuracies": 0.6300000548362732,
|
1182 |
+
"rewards/chosen": 0.02889620140194893,
|
1183 |
+
"rewards/margins": 0.014323192648589611,
|
1184 |
+
"rewards/rejected": 0.014573007822036743,
|
1185 |
+
"step": 750
|
1186 |
+
},
|
1187 |
+
{
|
1188 |
+
"epoch": 0.99,
|
1189 |
+
"learning_rate": 4.1821938386477075e-11,
|
1190 |
+
"logits/chosen": -1.7962977886199951,
|
1191 |
+
"logits/rejected": -1.7127879858016968,
|
1192 |
+
"logps/chosen": -2801.806640625,
|
1193 |
+
"logps/rejected": -2341.844970703125,
|
1194 |
+
"loss": 46.0674,
|
1195 |
+
"rewards/accuracies": 0.5700000524520874,
|
1196 |
+
"rewards/chosen": 0.009056088514626026,
|
1197 |
+
"rewards/margins": 0.013271180912852287,
|
1198 |
+
"rewards/rejected": -0.004215092398226261,
|
1199 |
+
"step": 760
|
1200 |
+
},
|
1201 |
+
{
|
1202 |
+
"epoch": 1.0,
|
1203 |
+
"step": 764,
|
1204 |
+
"total_flos": 0.0,
|
1205 |
+
"train_loss": 46.613421885577296,
|
1206 |
+
"train_runtime": 4597.6924,
|
1207 |
+
"train_samples_per_second": 13.297,
|
1208 |
+
"train_steps_per_second": 0.166
|
1209 |
+
}
|
1210 |
+
],
|
1211 |
+
"logging_steps": 10,
|
1212 |
+
"max_steps": 764,
|
1213 |
+
"num_input_tokens_seen": 0,
|
1214 |
+
"num_train_epochs": 1,
|
1215 |
+
"save_steps": 100,
|
1216 |
+
"total_flos": 0.0,
|
1217 |
+
"train_batch_size": 5,
|
1218 |
+
"trial_name": null,
|
1219 |
+
"trial_params": null
|
1220 |
+
}
|