sajad-movahedi commited on
Commit
137a25c
·
verified ·
1 Parent(s): 6e87127

Rename sudoku-singlez-pnone -> sudoku

Browse files
sudoku-singlez-pnone/all_config.yaml DELETED
@@ -1,82 +0,0 @@
1
- arch:
2
- H_cycles: 3
3
- H_layers: 0
4
- L_cycles: 6
5
- L_layers: 2
6
- alpha_1_init: 0.75
7
- alpha_2_init: 0.25
8
- conv_bias: false
9
- conv_kernel_size: 3
10
- conv_type: conv2d
11
- decay_patience: 5
12
- eps: 1.0e-08
13
- expansion: 4
14
- expon_scale: 72.1347520444
15
- forward_dtype: bfloat16
16
- fp_thresh: 0.1
17
- gamma_alpha: 4.0
18
- gamma_scale: 16.6666666667
19
- hidden_size: 512
20
- loss:
21
- deep_supervision: true
22
- loss_type: stablemax_cross_entropy
23
- name: losses@ACTLossHead
24
- q_loss_coeff: 0.5
25
- max_iter: 12
26
- max_iter_dist: det
27
- max_iter_eval: 1000
28
- mlp_t: false
29
- n_backwards_L: 6
30
- n_decode_steps: 0
31
- name: fixed_point_reasoning.fp_trm_singlez@FPTinyRecursiveReasoningModelSingleZ_ACTV1
32
- no_ACT_continue: true
33
- norm_placement: none
34
- norm_type: pre-norm
35
- normalize_input_injection: false
36
- num_heads: 8
37
- outer_only: false
38
- outlier_quantile: 0.25
39
- pos_encodings: rope
40
- puzzle_emb_len: 16
41
- puzzle_emb_ndim: 512
42
- residual_scale: input-independent
43
- scale_init: 2.0
44
- softmax_temp: 1.0
45
- stepsize: 1.0
46
- stepsize_decay: 0.9
47
- variational_dropout: 0.0
48
- weight_dropout: 0.0
49
- beta1: 0.9
50
- beta2: 0.95
51
- checkpoint_every_eval: true
52
- checkpoint_every_n_steps: null
53
- checkpoint_path: /ptmp/samova/reasoning-model-ablation/checkpoints/reasoning-model-ablation/fptrm_singlez_combined_best_train_det12_eval1000_pnone_lr1e-3_wd0.001_20260518_132719
54
- data_paths:
55
- - data/sudoku-extreme-1k-aug-1000
56
- data_paths_test: []
57
- ema: true
58
- ema_rate: 0.999
59
- epochs: 60000
60
- eval_interval: 5000
61
- eval_save_outputs: []
62
- evaluators: []
63
- freeze_weights: false
64
- global_batch_size: 768
65
- k_eval_max: null
66
- k_eval_min: null
67
- k_eval_step: 1
68
- load_checkpoint: null
69
- lr: 0.001
70
- lr_min_ratio: 1.0
71
- lr_warmup_steps: 2000
72
- metrics_out: null
73
- min_eval_interval: 0
74
- optimizer: adamw
75
- profile_flops: false
76
- project_name: reasoning-model-ablation
77
- puzzle_emb_lr: 0.001
78
- puzzle_emb_weight_decay: 0.001
79
- resume_from: null
80
- run_name: fptrm_singlez_combined_best_train_det12_eval1000_pnone_lr1e-3_wd0.001_20260518_132719
81
- seed: 0
82
- weight_decay: 0.001
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sudoku-singlez-pnone/fp_trm_singlez.py DELETED
@@ -1,287 +0,0 @@
1
- from dataclasses import dataclass
2
- from typing import Tuple, Dict, Generator, Union
3
- import math
4
- import random
5
- import torch
6
- import torch.nn.functional as F
7
- from torch import nn
8
-
9
- from scipy.stats import gamma, expon
10
-
11
- from ..layers import (
12
- RotaryEmbedding,
13
- CastedEmbedding,
14
- CastedLinear,
15
- rms_norm,
16
- )
17
- from ..sparse_embedding import CastedSparseEmbedding
18
- from ..transformer import FixedPointTransformer
19
-
20
- from .fp_trm_config import FPTRMConfig
21
- from .model_utils import FixedPointOptimizer
22
-
23
- IGNORE_LABEL_ID = -100
24
-
25
-
26
- @dataclass
27
- class FPTinyRecursiveReasoningModelSingleZ_ACTV1InnerCarry:
28
- z_L_state: dict
29
- dropout_mask: torch.Tensor
30
-
31
- @dataclass
32
- class FPTinyRecursiveReasoningModelSingleZ_ACTV1Carry:
33
- inner_carry: FPTinyRecursiveReasoningModelSingleZ_ACTV1InnerCarry
34
-
35
- steps: torch.Tensor
36
- halted: torch.Tensor
37
-
38
- current_data: Dict[str, torch.Tensor]
39
-
40
-
41
- class FixedPointTinyRecursiveReasoningModel_SingleZ_Inner(nn.Module):
42
- def __init__(self, config: FPTRMConfig) -> None:
43
- super().__init__()
44
- self.config = config
45
- self.forward_dtype = getattr(torch, self.config.forward_dtype)
46
-
47
- # I/O
48
-
49
- self.embed_scale = math.sqrt(self.config.hidden_size)
50
- embed_init_std = 1.0 / self.embed_scale
51
-
52
- self.embed_tokens = CastedEmbedding(self.config.vocab_size, self.config.hidden_size, init_std=embed_init_std, cast_to=self.forward_dtype)
53
- self.lm_head = CastedLinear(self.config.hidden_size, self.config.vocab_size, bias=False)
54
- self.q_head = CastedLinear(self.config.hidden_size, 2, bias=True)
55
-
56
- self.puzzle_emb_len = -(self.config.puzzle_emb_ndim // -self.config.hidden_size) if self.config.puzzle_emb_len == 0 else self.config.puzzle_emb_len
57
- if self.config.puzzle_emb_ndim > 0:
58
- # Zero init puzzle embeddings
59
- self.puzzle_emb = CastedSparseEmbedding(self.config.num_puzzle_identifiers, self.config.puzzle_emb_ndim,
60
- batch_size=self.config.batch_size, init_std=0, cast_to=self.forward_dtype)
61
-
62
- # LM Blocks
63
- if self.config.pos_encodings == "rope":
64
- self.rotary_emb = RotaryEmbedding(dim=self.config.hidden_size // self.config.num_heads,
65
- max_position_embeddings=self.config.seq_len + self.puzzle_emb_len,
66
- base=self.config.rope_theta)
67
- elif self.config.pos_encodings == "learned":
68
- self.embed_pos = CastedEmbedding(self.config.seq_len + self.puzzle_emb_len, self.config.hidden_size, init_std=embed_init_std, cast_to=self.forward_dtype)
69
- else:
70
- pass
71
-
72
- # Reasoning Layers
73
- self.L_level = FixedPointTransformer(self.config, self.config.L_layers)
74
-
75
- self.L_optimizer = FixedPointOptimizer(self.config)
76
-
77
- # Q head special init
78
- # Init Q to (almost) zero for faster learning during bootstrapping
79
- with torch.no_grad():
80
- self.q_head.weight.zero_()
81
- self.q_head.bias.fill_(-5) # type: ignore
82
-
83
- def _input_embeddings(self, input: torch.Tensor, puzzle_identifiers: torch.Tensor):
84
- # Token embedding
85
- embedding = self.embed_tokens(input.to(torch.int32))
86
-
87
- # Puzzle embeddings
88
- if self.config.puzzle_emb_ndim > 0:
89
- puzzle_embedding = self.puzzle_emb(puzzle_identifiers)
90
-
91
- pad_count = self.puzzle_emb_len * self.config.hidden_size - puzzle_embedding.shape[-1]
92
- if pad_count > 0:
93
- puzzle_embedding = F.pad(puzzle_embedding, (0, pad_count))
94
-
95
- embedding = torch.cat((puzzle_embedding.view(-1, self.puzzle_emb_len, self.config.hidden_size), embedding), dim=-2)
96
-
97
- # Position embeddings
98
- if self.config.pos_encodings == "learned":
99
- # scale by 1/sqrt(2) to maintain forward variance
100
- embedding = 0.707106781 * (embedding + self.embed_pos.embedding_weight.to(self.forward_dtype))
101
-
102
- # Scale
103
- return self.embed_scale * embedding
104
-
105
- def empty_carry(self, batch_size: int):
106
- return FPTinyRecursiveReasoningModelSingleZ_ACTV1InnerCarry(
107
- z_L_state = None,
108
- dropout_mask = None,
109
- )
110
-
111
- def reset_carry(self,
112
- reset_flag: torch.Tensor,
113
- batch: torch.Tensor,
114
- carry: FPTinyRecursiveReasoningModelSingleZ_ACTV1InnerCarry):
115
- shape = (batch.shape[0], batch.shape[1] + self.puzzle_emb_len, self.config.hidden_size)
116
- device = batch.device
117
- dtype = self.forward_dtype
118
-
119
- if self.training:
120
- dropout_mask = torch.empty(*shape, device=device, dtype=dtype).bernoulli_(p=1 - self.config.variational_dropout).div_(1 - self.config.variational_dropout)
121
- if carry.dropout_mask is not None:
122
- dropout_mask = torch.where(reset_flag.view(-1, 1, 1), dropout_mask, carry.dropout_mask)
123
- else:
124
- dropout_mask = torch.ones(*shape, device=device, dtype=dtype)
125
-
126
- return FPTinyRecursiveReasoningModelSingleZ_ACTV1InnerCarry(
127
- z_L_state = self.L_optimizer.reset(reset_flag, shape, dtype, device, carry.z_L_state),
128
- dropout_mask=dropout_mask,
129
- )
130
-
131
- def _z_step(self, state: Dict[str, torch.Tensor], input_embeddings: torch.Tensor,
132
- dropout_mask: torch.Tensor, seq_info: Dict[str, any]):
133
- z_new = dropout_mask * self.L_level(state["y"], input_embeddings, **seq_info)
134
- return self.L_optimizer.step(state, z_new)
135
-
136
- def forward(self,
137
- carry: FPTinyRecursiveReasoningModelSingleZ_ACTV1InnerCarry,
138
- batch: Dict[str, torch.Tensor],
139
- force_grad: bool,
140
- n_steps: int) -> Tuple[
141
- Tuple[FPTinyRecursiveReasoningModelSingleZ_ACTV1InnerCarry, torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]
142
- ]:
143
- input_embeddings = self._input_embeddings(batch["inputs"], batch["puzzle_identifiers"])
144
-
145
- # Slice rotary cache to the actual input length so the same model
146
- # can be evaluated at sequence lengths shorter than config.seq_len
147
- # (length-generalisation for state tracking).
148
- cos_sin = None
149
- if hasattr(self, "rotary_emb"):
150
- cos, sin = self.rotary_emb()
151
- s = input_embeddings.shape[1]
152
- cos_sin = (cos[:s], sin[:s])
153
- seq_info = dict(cos_sin=cos_sin, puzzle_emb_len=self.puzzle_emb_len)
154
- z_state, dropout_mask = carry.z_L_state, carry.dropout_mask
155
-
156
- with torch.set_grad_enabled(force_grad):
157
- for _ in range(n_steps):
158
- z_state = self._z_step(z_state, input_embeddings, dropout_mask, seq_info)
159
-
160
- pred_rep = z_state['y']
161
- for n in range(self.config.n_decode_steps):
162
- pred_rep = self.L_level(pred_rep, z_state['y'], **seq_info)
163
-
164
- # pred_rep = rms_norm(pred_rep, variance_epsilon=self.config.rms_norm_eps)
165
-
166
- output = self.lm_head(pred_rep)[:, self.puzzle_emb_len:]
167
- q_logits = self.q_head(pred_rep[:, 0]).to(torch.float32) # Q-head; uses the first puzzle_emb position
168
- new_carry = FPTinyRecursiveReasoningModelSingleZ_ACTV1InnerCarry(z_L_state=self.L_optimizer.detach_state(z_state),
169
- dropout_mask=carry.dropout_mask) # New carry no grad
170
- return new_carry, output, (q_logits[..., 0], q_logits[..., 1])
171
-
172
-
173
- class FPTinyRecursiveReasoningModelSingleZ_ACTV1(nn.Module):
174
- """Single-state FPTRM wrapper."""
175
-
176
- def __init__(self, config_dict: dict):
177
- super().__init__()
178
- self.config = FPTRMConfig(**config_dict)
179
- self.inner = FixedPointTinyRecursiveReasoningModel_SingleZ_Inner(self.config)
180
-
181
- @property
182
- def puzzle_emb(self):
183
- return self.inner.puzzle_emb
184
-
185
- def initial_carry(self, batch: Dict[str, torch.Tensor]):
186
- batch_size = batch["inputs"].shape[0]
187
-
188
- return FPTinyRecursiveReasoningModelSingleZ_ACTV1Carry(
189
- inner_carry=self.inner.empty_carry(batch_size), # Empty is expected, it will be reseted in first pass as all sequences are halted.
190
-
191
- steps=torch.zeros((batch_size, ), dtype=torch.int32),
192
- halted=torch.ones((batch_size, ), dtype=torch.bool), # Default to halted
193
-
194
- current_data={k: torch.empty_like(v) for k, v in batch.items()}
195
- )
196
-
197
- def set_num_iters(self):
198
- if self.training:
199
- if self.config.max_iter_dist == 'gamma':
200
- sampled_max_iter = gamma.rvs(a=self.config.gamma_alpha, scale=self.config.gamma_scale)
201
- elif self.config.max_iter_dist == 'expon':
202
- sampled_max_iter = expon.rvs(scale=self.config.expon_scale)
203
- elif self.config.max_iter_dist == 'det':
204
- sampled_max_iter = self.config.max_iter
205
-
206
- if self.config.max_iter_dist == 'det':
207
- self.max_iter = max(0, int(sampled_max_iter))
208
- else:
209
- self.max_iter = max(1, int(sampled_max_iter))
210
- else:
211
- self.max_iter = self.config.max_iter_eval if self.config.max_iter_eval is not None else self.config.max_iter
212
-
213
- def forward(
214
- self,
215
- carry: FPTinyRecursiveReasoningModelSingleZ_ACTV1Carry,
216
- batch: Dict[str, torch.Tensor],
217
- ):
218
- # Update data, carry (removing halted sequences)
219
- # Handled inside the optimizer
220
- new_inner_carry = self.inner.reset_carry(carry.halted, batch['inputs'], carry.inner_carry)
221
-
222
- new_steps = torch.where(carry.halted, 0, carry.steps)
223
-
224
- new_current_data = {k: torch.where(carry.halted.view((-1, ) + (1, ) * (batch[k].ndim - 1)), batch[k], v) for k, v in carry.current_data.items()}
225
-
226
- # Forward-backward inner model
227
- n_steps = self.config.n_backwards_L if self.training else 1
228
- new_inner_carry, logits, (q_halt_logits, q_continue_logits) = self.inner(new_inner_carry, new_current_data,
229
- force_grad=self.training, n_steps=n_steps)
230
-
231
- outputs = {
232
- "logits": logits,
233
- "q_halt_logits": q_halt_logits,
234
- "q_continue_logits": q_continue_logits
235
- }
236
-
237
- with torch.no_grad():
238
- # Step
239
- new_steps = new_steps + 1
240
-
241
- if self.config.halting_mechanism == 'act':
242
- is_last_step = new_steps >= self.config.halt_max_steps
243
- else:
244
- is_last_step = new_steps >= self.max_iter
245
-
246
- halted = is_last_step
247
-
248
- # if testing, use fixed-points
249
- if not self.training:
250
- # during inference we only halt for the entire sequence
251
- halted = halted | (new_inner_carry.z_L_state['residues'].max() < self.config.fp_thresh) \
252
- | (new_inner_carry.z_L_state['stepsize'].max() < 1e-3)
253
-
254
- # if training, and ACT is enabled
255
- cap = self.config.halt_max_steps if self.config.halting_mechanism == 'act' else self.max_iter
256
- if self.training and (cap > 1):
257
-
258
- if self.config.halting_mechanism == 'act':
259
- if self.config.no_ACT_continue:
260
- halted = halted | (q_halt_logits > 0)
261
- else:
262
- halted = halted | (q_halt_logits > q_continue_logits)
263
-
264
- # Exploration
265
- min_halt_steps = (torch.rand_like(q_halt_logits) < self.config.halt_exploration_prob) * torch.randint_like(new_steps, low=2, high=self.config.halt_max_steps + 1)
266
- halted = halted & (new_steps >= min_halt_steps)
267
-
268
- elif self.config.halting_mechanism == 'fixed_point':
269
- # Exploration is implemented by self.max_iter if we choose to use it
270
- halted = halted | (new_inner_carry.z_L_state['residues'] < self.config.fp_thresh) \
271
- | (new_inner_carry.z_L_state['stepsize'].view(-1) < 1e-3)
272
-
273
- elif self.config.halting_mechanism == 'fixed_iterations':
274
- pass
275
-
276
- else:
277
- raise ValueError("FPTRM with singleZ looping only accepts ACT, Fixed_point, and Fixed_iterations as its halting mechanism.")
278
-
279
- if not self.config.no_ACT_continue:
280
- # Compute target Q
281
- # NOTE: No replay buffer and target networks for computing target Q-value.
282
- # As batch_size is large, there're many parallel envs.
283
- # Similar concept as PQN https://arxiv.org/abs/2407.04811
284
- _, _, (next_q_halt_logits, next_q_continue_logits) = self.inner(new_inner_carry, new_current_data, force_grad=False, n_steps=1)
285
- outputs["target_q_continue"] = torch.sigmoid(torch.where(is_last_step, next_q_halt_logits, torch.maximum(next_q_halt_logits, next_q_continue_logits)))
286
-
287
- return FPTinyRecursiveReasoningModelSingleZ_ACTV1Carry(new_inner_carry, new_steps, halted, new_current_data), outputs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sudoku-singlez-pnone/losses.py DELETED
@@ -1,120 +0,0 @@
1
- from typing import Any, Tuple, Dict, Sequence, Optional
2
-
3
- import torch
4
- import torch.nn.functional as F
5
- from torch import nn
6
- import math
7
-
8
- IGNORE_LABEL_ID = -100
9
-
10
-
11
- def s(x, epsilon=1e-30):
12
- return torch.where(
13
- x<0,
14
- 1/(1-x+ epsilon),
15
- x + 1
16
- )
17
-
18
-
19
- def log_stablemax(x, dim=-1):
20
- s_x = s(x)
21
- return torch.log(s_x/torch.sum(s_x, dim=dim, keepdim=True))
22
-
23
-
24
- def stablemax_cross_entropy(logits, labels, ignore_index: int = -100, valid_mask=None):
25
- logprobs = log_stablemax(logits.to(torch.float64), dim=-1)
26
-
27
- if valid_mask is None:
28
- valid_mask = (labels != ignore_index)
29
- transformed_labels = torch.where(valid_mask, labels, 0)
30
- prediction_logprobs = torch.gather(logprobs, index=transformed_labels.to(torch.long).unsqueeze(-1), dim=-1).squeeze(-1)
31
-
32
- return -torch.where(valid_mask, prediction_logprobs, 0)
33
-
34
-
35
- def softmax_cross_entropy(logits, labels, ignore_index: int = -100):
36
- # Cast logits to f32
37
- # Flatten logits
38
- return F.cross_entropy(logits.to(torch.float32).view(-1, logits.shape[-1]), labels.to(torch.long).view(-1), ignore_index=ignore_index, reduction="none").view(labels.shape)
39
-
40
-
41
- class ACTLossHead(nn.Module):
42
- def __init__(self, model: nn.Module, loss_type: str, q_loss_coeff: float = 0.5, deep_supervision: bool = True):
43
- super().__init__()
44
- self.model = model
45
- self.loss_fn = globals()[loss_type]
46
- self.deep_supervision = deep_supervision
47
- self.q_loss_coeff = q_loss_coeff
48
-
49
- def initial_carry(self, *args, **kwargs):
50
- return self.model.initial_carry(*args, **kwargs) # type: ignore
51
-
52
- def set_num_iters(self, *args, **kwargs):
53
- if hasattr(self.model, "set_num_iters"):
54
- return self.model.set_num_iters(*args, **kwargs) # type: ignore
55
- return None
56
-
57
- def forward(
58
- self,
59
- return_keys: Sequence[str],
60
- # Model args
61
- **model_kwargs,
62
- ) -> Tuple[Any, torch.Tensor, Dict[str, torch.Tensor], Optional[Dict[str, torch.Tensor]], torch.Tensor]:
63
- # Model logits
64
- # B x SeqLen x D
65
- new_carry, outputs = self.model(**model_kwargs)
66
- labels = new_carry.current_data["labels"]
67
-
68
- with torch.no_grad():
69
- # Preds
70
- outputs["preds"] = torch.argmax(outputs["logits"], dim=-1)
71
-
72
- # Correctness
73
- mask = (labels != IGNORE_LABEL_ID)
74
- loss_counts = mask.sum(-1)
75
- loss_divisor = loss_counts.clamp_min(1).unsqueeze(-1) # Avoid NaNs in division
76
-
77
- is_correct = mask & (torch.argmax(outputs["logits"], dim=-1) == labels)
78
- seq_is_correct = is_correct.sum(-1) == loss_counts
79
-
80
- # Metrics (halted)
81
- valid_metrics = new_carry.halted & (loss_counts > 0)
82
- metrics = {
83
- "count": valid_metrics.sum(),
84
-
85
- "accuracy": torch.where(valid_metrics, (is_correct.to(torch.float32) / loss_divisor).sum(-1), 0).sum(),
86
- "sequence_accuracy": (valid_metrics & seq_is_correct).sum(),
87
-
88
- "q_halt_accuracy": (valid_metrics & ((outputs["q_halt_logits"] >= 0) == seq_is_correct)).sum(),
89
- "steps": torch.where(valid_metrics, new_carry.steps, 0).sum(),
90
- }
91
-
92
- # Losses
93
- lm_loss = (self.loss_fn(outputs["logits"], labels, ignore_index=IGNORE_LABEL_ID, valid_mask=mask) / loss_divisor).sum()
94
-
95
- if self.deep_supervision:
96
- masked_loss = lm_loss
97
- else:
98
- lm_mask = mask & new_carry.halted.unsqueeze(-1)
99
- lm_loss_counts = lm_mask.sum(-1)
100
- lm_loss_divisor = lm_loss_counts.clamp_min(1).unsqueeze(-1)
101
- masked_loss = (self.loss_fn(outputs["logits"], labels, ignore_index=IGNORE_LABEL_ID, valid_mask=lm_mask) / lm_loss_divisor).sum()
102
-
103
- q_halt_loss = F.binary_cross_entropy_with_logits(outputs["q_halt_logits"], seq_is_correct.to(outputs["q_halt_logits"].dtype), reduction="sum")
104
- metrics.update({
105
- "lm_loss": lm_loss.detach(),
106
- "q_halt_loss": q_halt_loss.detach(),
107
- })
108
- # Q continue (bootstrapping target loss); Alexia: This fits Q-learning, but seems totally unecessary
109
- q_continue_loss = 0
110
- if "target_q_continue" in outputs:
111
- q_continue_loss = F.binary_cross_entropy_with_logits(outputs["q_continue_logits"], outputs["target_q_continue"], reduction="sum")
112
-
113
- metrics["q_continue_loss"] = q_continue_loss.detach()
114
- # Filter outputs for return
115
- detached_outputs = {k: outputs[k].detach() for k in return_keys if k in outputs}
116
-
117
- masked_full_loss = masked_loss + self.q_loss_coeff * (q_halt_loss + q_continue_loss)
118
- full_loss = lm_loss + self.q_loss_coeff * (q_halt_loss + q_continue_loss)
119
-
120
- return new_carry, masked_full_loss, full_loss, metrics, detached_outputs, new_carry.halted.all()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sudoku-singlez-pnone/step_13020 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1aade6854944a2706028a43156d94617853a2f64d489ce95be0d77e37ef5098b
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_13020_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:701a95575029b44065dd7d3ffd162382600b8be97fc75f21dfa29250510da586
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_19530 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:185fa9d54cba9be3b4b59ace4dfb7ba41e17a1b614515c6ea9ec88a3bccee195
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_19530_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6246176265df5d7a7daae6c04d7a4c8df0a4a30994530cc5231124ebb7bc75a4
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_26040 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:03071c77df51c04d86a1ea8bee05e5ac0916ea05443539003e910b17d324f49b
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_26040_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e9300b21a85a275c43f5de1c15074301284d22e4bc56378182c0af67bd220e05
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_32550 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:83a7e57b6ef6ba98c4b12a19b09b4c902faf0561e35e62d8a8d3c1e7a24e5486
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_32550_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:27a7e92aeeb1234babd653c411ce8816b21a99da714298c388c7f84f0005c99d
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_39060 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:7c2434fca655691f8705afbfa1e5141d50f8915d77e5441da8fdd08c7a18bcb5
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_39060_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:7e955bc81bafae080278c4043b33abc2d85c6fc91356ce3bc30ee68950a85d3d
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_45570 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1ede0cf1e32abc46e9b10ecc09aa89586eea380239bf518d667b1ea88ab7184a
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_45570_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:beb548b8a7ab24736fff8682f0866ad5df686061226ba976a603ec3b6e8e515c
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_52080 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:65b9cb59f9140cced2c44f71680702910b69408e4d9130d00b576699743ab058
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_52080_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:0414349f629ba200e8445fdd6b363bbad084161baa5b85034aad066a8e15bbd2
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_58590 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e9803b184dbaf0626ac8ecd902f8faeca24e22e9cba41d68dc23d104bdd9a288
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_58590_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:5b07f51d23b9c1f8abc622049d8d750b345a9a3b0c0f20bccfdcdddf9bb13b46
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_6510 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:62ce4721f876e7d42d86f810c51260dfdad34b080fb4938c47e467b6dc8e2878
3
- size 54637525
 
 
 
 
sudoku-singlez-pnone/step_65100 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:9bee900d19bb6558b6335072f7899f4564ef50a4c328ceee587adcd017350ca5
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_65100_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6d99a467228a4fd8caa914319e85f95d2b28147eccdd9f00af35f3ede79cf879
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_6510_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:2a30a1165b89455423b166550f2500db4542f64d99ebe66377a732a9aaa310a8
3
- size 136661289
 
 
 
 
sudoku-singlez-pnone/step_71610 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e287624929425d92797327735f33b833feaf18d99026e24de1bb22dde5086d06
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_71610_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:5c5928bf691b2139d4f0acdbdfad8bf1716c6b2a7eb2e44694bd8054e14156b9
3
- size 136661509
 
 
 
 
sudoku-singlez-pnone/step_78120 DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6daec5f499d115beb14e23f3a9cf56d1166b99c1ccd36b185a19ea5dfec9a137
3
- size 54637557
 
 
 
 
sudoku-singlez-pnone/step_78120_train_state.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:abe3286dc6df1e2a70fc366efce6c1a0804811a3d02c032dd513f646b3a79105
3
- size 136661509