-
Notifications
You must be signed in to change notification settings - Fork 201
/
Copy path31d6c427-f1f7-4d8a-91be-a67b5dcd13fd.txt
2018 lines (1947 loc) · 100 KB
/
31d6c427-f1f7-4d8a-91be-a67b5dcd13fd.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import os
import sys
with open(sys.argv[0]) as f:
code = f.read() # read the code of this file ASAP, for logging
import uuid
import time
import glob
import subprocess
import contextlib
from dataclasses import dataclass
import torch
torch.empty(1, device='cuda', requires_grad=True).backward()
from torch import nn
import torch.nn.functional as F
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
# use of FlexAttention contributed by @KoszarskyB
from torch.nn.attention.flex_attention import BlockMask, flex_attention
# -----------------------------------------------------------------------------
# Muon optimizer
@torch.compile
def zeropower_via_newtonschulz5(G, steps):
"""
Newton-Schulz iteration to compute the zeroth power / orthogonalization of G. We opt to use a
quintic iteration whose coefficients are selected to maximize the slope at zero. For the purpose
of minimizing steps, it turns out to be empirically effective to keep increasing the slope at
zero even beyond the point where the iteration no longer converges all the way to one everywhere
on the interval. This iteration therefore does not produce UV^T but rather something like US'V^T
where S' is diagonal with S_{ii}' ~ Uniform(0.5, 1.5), which turns out not to hurt model
performance at all relative to UV^T, where USV^T = G is the SVD.
"""
assert len(G.shape) == 2
a, b, c = (3.4445, -4.7750, 2.0315)
X = G.bfloat16()
if G.size(0) > G.size(1):
X = X.T
# Ensure spectral norm is at most 1
X = X / (X.norm() + 1e-7)
# Perform the NS iterations
for _ in range(steps):
A = X @ X.T
B = b * A + c * A @ A # adapted from suggestion by @jxbz, @leloykun, and @YouJiacheng
X = a * X + B @ X
if G.size(0) > G.size(1):
X = X.T
return X
class Muon(torch.optim.Optimizer):
"""
Muon - MomentUm Orthogonalized by Newton-schulz
Muon internally runs standard SGD-momentum, and then performs an orthogonalization post-
processing step, in which each 2D parameter's update is replaced with the nearest orthogonal
matrix. To efficiently orthogonalize each update, we use a Newton-Schulz iteration, which has
the advantage that it can be stably run in bfloat16 on the GPU.
Some warnings:
- This optimizer assumes that all parameters passed in are 2D.
- It should not be used for the embedding layer, the final fully connected layer, or any {0,1}-D
parameters; those should all be optimized by a standard method (e.g., AdamW).
- To use it with 4D convolutional filters, it works well to just flatten their last 3 dimensions.
- We believe it is unlikely to work well for training with small batch size.
- We believe it may not work well for finetuning pretrained models, but we haven't tested this.
- We have not yet tried this optimizer for training scenarios larger than NanoGPT (124M).
Arguments:
lr: The learning rate used by the internal SGD.
momentum: The momentum used by the internal SGD.
nesterov: Whether to use Nesterov-style momentum in the internal SGD. (recommended)
ns_steps: The number of Newton-Schulz iteration steps to use.
"""
def __init__(self, params, lr=0.02, momentum=0.95, nesterov=True, ns_steps=5):
self.world_size = int(os.environ['WORLD_SIZE'])
self.rank = int(os.environ['RANK'])
defaults = dict(lr=lr, momentum=momentum, nesterov=nesterov, ns_steps=ns_steps)
assert all(isinstance(p, torch.Tensor) for p in params)
sizes = {p.numel() for p in params}
param_groups = [dict(params=[p for p in params if p.numel() == size],
update_buffer=[torch.empty(size, device='cuda', dtype=torch.bfloat16) for _ in range(self.world_size)])
for size in sizes]
super().__init__(param_groups, defaults)
def step(self):
for group in self.param_groups:
lr = group['lr']
momentum = group['momentum']
nesterov = group['nesterov']
ns_steps = group['ns_steps']
update_buffers = group['update_buffer']
# generate weight updates in distributed fashion
params = group['params']
handle = None
params_world = None
def update_prev():
if params_world is None:
return
assert handle is not None
handle.wait()
for p_world, g_world in zip(params_world, update_buffers):
p_world.data.add_(
g_world.view_as(p_world),
alpha=-lr * max(1, p_world.size(0) / p_world.size(1)) ** 0.5,
)
for base_i in range(len(params))[::self.world_size]:
if base_i + rank < len(params):
p = params[base_i + self.rank]
g = p.grad
assert g is not None
state = self.state[p]
if 'momentum_buffer' not in state:
state['momentum_buffer'] = torch.zeros_like(g)
buf = state['momentum_buffer']
buf.lerp_(g, 1 - momentum)
g = g.lerp_(buf, momentum) if nesterov else buf
g = zeropower_via_newtonschulz5(g, steps=ns_steps).flatten()
else:
g = update_buffers[rank]
update_prev() # async all_gather instead of sync all_reduce by @YouJiacheng
handle = dist.all_gather(update_buffers, g, async_op=True)
params_world = params[base_i : base_i + self.world_size]
update_prev()
# -----------------------------------------------------------------------------
# PyTorch nn.Module definitions for the GPT-2 model
def norm(x):
return F.rms_norm(x, (x.size(-1),))
class CastedLinear(nn.Linear):
def __init__(self, in_features, out_features):
super().__init__(in_features, out_features, bias=False)
def forward(self, x):
return F.linear(x, self.weight.type_as(x))
class Rotary(nn.Module):
def __init__(self, dim, max_seq_len=65536):
super().__init__()
# half-truncate RoPE by @YouJiacheng
angular_freq = (1 / 1024) ** torch.linspace(0, 1, steps=dim//4, dtype=torch.float32)
angular_freq = torch.cat([angular_freq, angular_freq.new_zeros(dim//4)])
t = torch.arange(max_seq_len, dtype=torch.float32)
theta = torch.einsum('i,j -> ij', t, angular_freq)
self.cos = nn.Buffer(theta.cos(), persistent=False)
self.sin = nn.Buffer(theta.sin(), persistent=False)
def forward(self, x):
cos, sin = self.cos[None, :x.size(-3), None, :], self.sin[None, :x.size(-3), None, :]
x1, x2 = x.float().chunk(2, dim=-1)
y1 = x1 * cos + x2 * sin
y2 = x1 * (-sin) + x2 * cos
return torch.cat((y1, y2), 3).type_as(x)
class CausalSelfAttention(nn.Module):
def __init__(self, dim, num_heads):
super().__init__()
assert dim % num_heads == 0
self.num_heads = num_heads
self.c_q = CastedLinear(dim, dim)
self.c_k = CastedLinear(dim, dim)
self.c_v = CastedLinear(dim, dim)
self.lambdas = nn.Parameter(torch.tensor([0.5, 0.5]))
self.rotary = Rotary(dim // num_heads) # dim // num_heads = head_dim
self.c_proj = CastedLinear(dim, dim)
self.c_proj.weight.data.zero_() # zero init suggested by @Grad62304977
def forward(self, x, ve, block_mask):
B, T = x.size(0), x.size(1) # batch size, sequence length
assert B == 1, 'Must use batch size = 1 for FlexAttention'
q = self.c_q(x).view(B, T, self.num_heads, -1)
k = self.c_k(x).view(B, T, self.num_heads, -1)
v = self.c_v(x).view(B, T, self.num_heads, -1)
if ve is not None:
v = self.lambdas[0] * v + self.lambdas[1] * ve.view_as(v) # @KoszarskyB & @Grad62304977
else: # skip mid-layers token value embeddings by @YouJiacheng
v = self.lambdas[0] * v
q, k = norm(q), norm(k) # QK norm @Grad62304977
q, k = self.rotary(q), self.rotary(k)
y = flex_attention(q.transpose(1, 2), k.transpose(1, 2), v.transpose(1, 2), block_mask=block_mask)
y = y.transpose(1, 2).contiguous().view_as(x) # re-assemble all head outputs side by side
y = self.c_proj(y)
return y
class MLP(nn.Module):
def __init__(self, dim):
super().__init__()
self.c_fc = CastedLinear(dim, 4 * dim)
self.c_proj = CastedLinear(4 * dim, dim)
self.c_proj.weight.data.zero_() # zero init suggested by @Grad62304977
def forward(self, x):
x = self.c_fc(x)
x = F.relu(x).square() # https://arxiv.org/abs/2109.08668v2; ~1-2% better than GELU; suggested by @SKYLINEZ007 and @Grad62304977
x = self.c_proj(x)
return x
class Block(nn.Module):
def __init__(self, model_dim, num_heads, use_attn=True):
super().__init__()
self.attn = CausalSelfAttention(model_dim, num_heads) if use_attn else None
self.mlp = MLP(model_dim)
self.lambdas = nn.Parameter(torch.tensor([1., 0.]))
def forward(self, x, ve, x0, block_mask):
x = self.lambdas[0] * x + self.lambdas[1] * x0
if self.attn is not None:
x = x + self.attn(norm(x), ve, block_mask)
x = x + self.mlp(norm(x))
return x
class ValueEmbedding(nn.Module):
def __init__(self, vocab_size, model_dim):
super().__init__()
self.embed = nn.ModuleList([nn.Embedding(vocab_size, model_dim) for _ in range(3)])
def forward(self, inputs):
ve = [emb(inputs).bfloat16() for emb in self.embed]
# 012 ... 012 structure on token value embeddings by @YouJiacheng, improved on @leloykun's U-net structure
ve = [ve[0], ve[1], ve[2], None, None, None, None, None, None, ve[0], ve[1], ve[2]]
return ve
# -----------------------------------------------------------------------------
# The main GPT-2 model
class GPT(nn.Module):
def __init__(self, vocab_size, num_layers, num_heads, model_dim):
super().__init__()
self.embed = nn.Embedding(vocab_size, model_dim)
# skip attention of blocks.7 (the 8th layer) by @YouJiacheng
self.blocks = nn.ModuleList([Block(model_dim, num_heads, use_attn=(i != 7))
for i in range(num_layers)])
# token value embeddings by @KoszarskyB - inspired by @Grad62304977's value residual learning
# U-net structure on token value embeddings by @leloykun
self.value_embeds = ValueEmbedding(vocab_size, model_dim)
self.lm_head = CastedLinear(model_dim, vocab_size)
self.lm_head.weight.data.zero_() # @Grad62304977
# U-net design by @brendanh0gan
self.num_encoder_layers = num_layers // 2 # Half of the layers for encoder
self.num_decoder_layers = num_layers - self.num_encoder_layers # Remaining for decoder
# Add learnable skip connection weights for decoder layers
self.skip_weights = nn.Parameter(torch.ones(self.num_decoder_layers))
def forward(self, inputs, targets, sliding_window_num_blocks):
BLOCK_SIZE = 128
seq_len = len(inputs)
assert seq_len % BLOCK_SIZE == 0
total_num_blocks = seq_len // BLOCK_SIZE
assert inputs.ndim == 1
docs = (inputs == 50256).cumsum(0)
docs_low = docs.view(-1, BLOCK_SIZE)[:, 0].contiguous()
docs_high = docs.view(-1, BLOCK_SIZE)[:, -1].contiguous()
def document_causal(b, h, q_idx, kv_idx):
causal_mask = q_idx >= kv_idx
document_mask = docs[q_idx] == docs[kv_idx]
return causal_mask & document_mask
def dense_to_ordered(dense_mask):
num_blocks = dense_mask.sum(dim=-1, dtype=torch.int32)
indices = dense_mask.argsort(dim=-1, descending=True, stable=True).to(torch.int32)
return num_blocks[None, None].contiguous(), indices[None, None].contiguous()
def create_doc_swc_block_mask(sliding_window_num_blocks):
kv_idx = block_idx = torch.arange(total_num_blocks, dtype=torch.int32, device='cuda')
q_idx = block_idx[:, None]
causal_bm = q_idx >= kv_idx
causal_full_bm = q_idx > kv_idx
window_bm = q_idx - kv_idx < sliding_window_num_blocks
window_full_bm = window_bm # block-wise sliding window by @YouJiacheng
# document_bm = (docs_low[q_idx] <= docs_high[kv_idx]) & (docs_low[kv_idx] <= docs_high[q_idx])
document_bm = (docs_low[:, None] <= docs_high) & (docs_low <= docs_high[:, None])
document_full_bm = (docs_low[:, None] == docs_high) & (docs_low == docs_high[:, None])
nonzero_bm = causal_bm & window_bm & document_bm
full_bm = causal_full_bm & window_full_bm & document_full_bm
kv_num_blocks, kv_indices = dense_to_ordered(nonzero_bm & ~full_bm)
full_kv_num_blocks, full_kv_indices = dense_to_ordered(full_bm)
return BlockMask.from_kv_blocks(
kv_num_blocks,
kv_indices,
full_kv_num_blocks,
full_kv_indices,
BLOCK_SIZE=BLOCK_SIZE,
mask_mod=document_causal,
)
block_mask = create_doc_swc_block_mask(sliding_window_num_blocks)
x0 = norm(self.embed(inputs[None]).bfloat16()) # use of norm here by @Grad62304977
x = x0
ve = self.value_embeds(inputs)
assert len(ve) == len(self.blocks)
ve_enc, ve_dec = ve[:self.num_encoder_layers], ve[self.num_encoder_layers:]
# Store outputs for U-Net skip connections
skip_connections = []
# Encoder pass - process only the first half of the blocks
for i in range(self.num_encoder_layers):
x = self.blocks[i](x, ve_enc[i], x0, block_mask)
skip_connections.append(x)
# Decoder pass - process the remaining blocks with weighted skip connections
for i in range(self.num_decoder_layers):
x = x + self.skip_weights[i] * skip_connections.pop()
# U-net structure on token value embeddings by @leloykun
x = self.blocks[self.num_encoder_layers + i](x, ve_dec[i], x0, block_mask)
x = norm(x)
logits = self.lm_head(x)
logits = 15 * torch.tanh(logits / 15) # @Grad62304977 added tanh softcapping, @KoszarskyB reduced it from 30 to 15
logits = logits.float()
loss = F.cross_entropy(logits.view(-1, logits.size(-1)), targets)
return loss
# -----------------------------------------------------------------------------
# Our own simple Distributed Data Loader
def _load_data_shard(path):
# only reads the header, returns header data
# header is 256 int32
header = torch.from_file(path, False, 256, dtype=torch.int32)
assert header[0] == 20240520, 'magic number mismatch in the data .bin file'
assert header[1] == 1, 'unsupported version'
num_tokens = int(header[2]) # number of tokens (claimed)
with open(path, 'rb', buffering=0) as f:
tokens = torch.empty(num_tokens, dtype=torch.uint16, pin_memory=True) # avoid pin_memory copy by @YouJiacheng
f.seek(256 * 4)
nbytes = f.readinto(tokens.numpy()) # avoid bytes->array copy by @YouJiacheng
assert nbytes == 2 * num_tokens, 'number of tokens read does not match header'
return tokens
class DistributedDataLoader:
def __init__(self, filename_pattern):
self.rank = int(os.environ['RANK'])
self.world_size = int(os.environ['WORLD_SIZE'])
self.files = sorted(glob.glob(filename_pattern))
self.reset()
def reset(self):
self.current_shard = -1
self.advance()
def advance(self):
self.current_shard = (self.current_shard + 1) % len(self.files)
self.current_position = 0
self.tokens = _load_data_shard(self.files[self.current_shard])
def next_batch(self, batch_size):
assert batch_size % self.world_size == 0
device_batch_size = batch_size // self.world_size
# load next shard if necessary
if self.current_position + batch_size + 1 >= len(self.tokens):
self.advance()
pos = self.current_position + self.rank * device_batch_size
device_batch_tokens = self.tokens[pos:pos+device_batch_size+1]
# advance current position
self.current_position += batch_size
inputs = device_batch_tokens[:-1].to(device='cuda', dtype=torch.int32, non_blocking=True)
targets = device_batch_tokens[1:].to(device='cuda', dtype=torch.int64, non_blocking=True)
return inputs, targets
# -----------------------------------------------------------------------------
# int main
@dataclass
class Hyperparameters:
# data
train_bin = 'data/fineweb10B/fineweb_train_*.bin' # input .bin to train on
val_bin = 'data/fineweb10B/fineweb_val_*.bin' # input .bin to eval validation loss on
# optimization
batch_size = 8*64*1024 # batch size in tokens
max_device_batch_size = 64*1024 # batch size per device in tokens
num_iterations = 1390 # number of iterations to run
cooldown_frac = 0.4 # fraction of training spent cooling down the learning rate
bf16_embeds = True
# evaluation and logging
val_loss_every = 125 # every how many steps to evaluate val loss? 0 for only at the end
val_tokens = 10485760 # how many tokens of validation data? it's important to keep this fixed for consistent comparisons
# implementation
save_checkpoint = False
args = Hyperparameters()
micro_bs = args.max_device_batch_size
# set up DDP (distributed data parallel). torchrun sets this env variable
rank = int(os.environ['RANK'])
local_rank = int(os.environ['LOCAL_RANK'])
world_size = int(os.environ['WORLD_SIZE'])
assert torch.cuda.is_available()
torch.cuda.set_device(local_rank)
dist.init_process_group(backend='nccl', device_id=torch.device(local_rank))
dist.barrier()
master_process = (rank == 0) # this process will do logging, checkpointing etc.
# begin logging
logfile = None
if master_process:
run_id = uuid.uuid4()
os.makedirs('logs', exist_ok=True)
logfile = f'logs/{run_id}.txt'
print(logfile)
def print0(s, console=False):
if master_process:
with open(logfile, 'a') as f:
if console:
print(s)
print(s, file=f)
# begin by printing this file (the Python code)
print0(code)
print0('='*100)
# log information about the hardware/software environment this is running on
print0(f'Running Python {sys.version}')
print0(f'Running PyTorch {torch.version.__version__} compiled for CUDA {torch.version.cuda}')
print0(subprocess.run(['nvidia-smi'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True).stdout)
print0('='*100)
# load data
train_loader = DistributedDataLoader(args.train_bin)
val_loader = DistributedDataLoader(args.val_bin)
print0(f'Training dataloader files: {train_loader.files}')
print0(f'Validation dataloader files: {val_loader.files}')
print0('='*100)
# there are only 50257 unique GPT-2 tokens; we extend to nearest multiple of 128 for efficiency. suggested to me by @Grad62304977.
# this originates from Karpathy's experiments.
model = GPT(vocab_size=50304, num_layers=12, num_heads=6, model_dim=768)
model = model.cuda()
if args.bf16_embeds:
for m in model.modules():
if isinstance(m, nn.Embedding):
m.bfloat16()
model = torch.compile(model)
ddp_model = DDP(model, device_ids=[local_rank], broadcast_buffers=False, gradient_as_bucket_view=True)
# collect the parameters to optimize
hidden_matrix_params = [p for p in model.blocks.parameters() if p.ndim == 2]
embed_params = [model.embed.weight, *model.value_embeds.parameters()]
scalar_params = [p for p in model.parameters() if p.ndim < 2]
head_params = [model.lm_head.weight]
# init the optimizer(s)
optimizer1 = torch.optim.Adam([dict(params=embed_params, lr=0.6),
dict(params=head_params, lr=0.008),
dict(params=scalar_params, lr=0.04)],
betas=(0.8, 0.95), fused=True)
optimizer2 = Muon(hidden_matrix_params, lr=0.05, momentum=0.95)
optimizers = [optimizer1, optimizer2]
# learning rate schedule: stable then decay
def get_lr(it):
t = 1 - it / args.num_iterations # time remaining in training
assert 1 >= t > 0
# 1) constant lr for first part of training
if t >= args.cooldown_frac:
return 1.0
# 2) then linear cooldown
else:
return t / args.cooldown_frac
schedulers = [torch.optim.lr_scheduler.LambdaLR(opt, get_lr) for opt in optimizers]
# sliding window size schedule: linear increase over training in chunks of 128 from 128 -> 1792. By @fernbear.bsky.social
def get_sliding_window_blocks(it):
x = it / args.num_iterations # training progress
assert 0 <= x <= 1
return int(((1 - x) * 128 + x * 1856) // 128)
sliding_window_num_blocks = torch.tensor(1, dtype=torch.int32, device='cuda')
# Start training loop
training_time_ms = 0
# start the clock
torch.cuda.synchronize()
t0 = time.perf_counter()
# begin training
train_steps = args.num_iterations
for step in range(train_steps + 1):
last_step = (step == train_steps)
# This effectively ignores timing first 10 steps, which are slower for weird reasons.
# Alternately, and slightly more correctly in terms of benchmarking, we could do 10
# steps with dummy data first, and then re-initialize the model and reset the loader.
if step == 10:
training_time_ms = 0
t0 = time.perf_counter()
timed_steps = float('nan') if step <= 11 else (step - 10) + 1 # <= 11 to avoid bug in val
sliding_window_num_blocks.copy_(get_sliding_window_blocks(step))
# --------------- VALIDATION SECTION -----------------
if last_step or (args.val_loss_every > 0 and step % args.val_loss_every == 0):
# stop the clock
torch.cuda.synchronize()
training_time_ms += 1000 * (time.perf_counter() - t0)
# run validation batches
model.eval()
val_loader.reset()
val_loss = 0.0
# calculate the number of steps to take in the val loop.
val_batch_size = world_size * micro_bs
assert args.val_tokens % val_batch_size == 0
val_steps = args.val_tokens // val_batch_size
for _ in range(val_steps):
with torch.no_grad():
inputs_val, targets_val = val_loader.next_batch(val_batch_size)
val_loss += ddp_model(inputs_val, targets_val, sliding_window_num_blocks)
dist.all_reduce(val_loss, op=dist.ReduceOp.AVG)
val_loss /= val_steps
# logging
print0(f'step:{step}/{train_steps} val_loss:{val_loss:.4f} train_time:{training_time_ms:.0f}ms step_avg:{training_time_ms/(timed_steps-1):.2f}ms', console=True)
# start the clock again
torch.cuda.synchronize()
t0 = time.perf_counter()
if last_step:
if master_process and args.save_checkpoint:
log = dict(step=step, code=code, model=model.state_dict(), optimizers=[opt.state_dict() for opt in optimizers])
os.makedirs(f'logs/{run_id}', exist_ok=True)
torch.save(log, f'logs/{run_id}/state_step{step:06d}.pt')
# the last step only has the validation loop, so break to avoid training
break
# --------------- TRAINING SECTION -----------------
model.train()
batch_size = args.batch_size
assert batch_size % world_size == 0
inputs_train, targets_train = train_loader.next_batch(batch_size)
assert len(inputs_train) <= micro_bs or len(inputs_train) % micro_bs == 0
for micro_inputs_train, micro_targets_train in zip(inputs_train.split(micro_bs), targets_train.split(micro_bs)):
ddp_model(micro_inputs_train, micro_targets_train, sliding_window_num_blocks).backward()
# momentum warmup for Muon
frac = min(step/300, 1)
for group in optimizer2.param_groups:
group['momentum'] = (1 - frac) * 0.85 + frac * 0.95
# step the optimizers and schedulers
for opt, sched in zip(optimizers, schedulers):
opt.step()
if step != train_steps-1:
sched.step()
# null the gradients
model.zero_grad(set_to_none=True)
# logging
approx_time = training_time_ms + 1000 * (time.perf_counter() - t0)
print0(f'step:{step+1}/{train_steps} train_time:{approx_time:.0f}ms step_avg:{approx_time/timed_steps:.2f}ms', console=True)
print0(f'peak memory consumption: {torch.cuda.max_memory_allocated() // 1024 // 1024} MiB')
dist.destroy_process_group()
====================================================================================================
Running Python 3.12.7 (main, Jan 4 2025, 08:08:20) [GCC 13.2.0]
Running PyTorch 2.6.0.dev20241231+cu126 compiled for CUDA 12.6
Sat Jan 4 08:29:45 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.127.05 Driver Version: 550.127.05 CUDA Version: 12.6 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA H100 80GB HBM3 On | 00000000:61:00.0 Off | 0 |
| N/A 28C P0 124W / 700W | 7746MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 1 NVIDIA H100 80GB HBM3 On | 00000000:62:00.0 Off | 0 |
| N/A 32C P0 121W / 700W | 3456MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 2 NVIDIA H100 80GB HBM3 On | 00000000:63:00.0 Off | 0 |
| N/A 33C P0 126W / 700W | 3456MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 3 NVIDIA H100 80GB HBM3 On | 00000000:64:00.0 Off | 0 |
| N/A 27C P0 118W / 700W | 3456MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 4 NVIDIA H100 80GB HBM3 On | 00000000:6A:00.0 Off | 0 |
| N/A 28C P0 115W / 700W | 3456MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 5 NVIDIA H100 80GB HBM3 On | 00000000:6B:00.0 Off | 0 |
| N/A 32C P0 116W / 700W | 3456MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 6 NVIDIA H100 80GB HBM3 On | 00000000:6C:00.0 Off | 0 |
| N/A 32C P0 119W / 700W | 3456MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 7 NVIDIA H100 80GB HBM3 On | 00000000:6D:00.0 Off | 0 |
| N/A 28C P0 118W / 700W | 3216MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+
====================================================================================================
Training dataloader files: ['data/fineweb10B/fineweb_train_000001.bin', 'data/fineweb10B/fineweb_train_000002.bin', 'data/fineweb10B/fineweb_train_000003.bin', 'data/fineweb10B/fineweb_train_000004.bin', 'data/fineweb10B/fineweb_train_000005.bin', 'data/fineweb10B/fineweb_train_000006.bin', 'data/fineweb10B/fineweb_train_000007.bin', 'data/fineweb10B/fineweb_train_000008.bin', 'data/fineweb10B/fineweb_train_000009.bin']
Validation dataloader files: ['data/fineweb10B/fineweb_val_000000.bin']
====================================================================================================
step:0/1390 val_loss:10.8258 train_time:0ms step_avg:nanms
step:1/1390 train_time:243813ms step_avg:nanms
step:2/1390 train_time:244359ms step_avg:nanms
step:3/1390 train_time:245864ms step_avg:nanms
step:4/1390 train_time:245997ms step_avg:nanms
step:5/1390 train_time:246131ms step_avg:nanms
step:6/1390 train_time:246264ms step_avg:nanms
step:7/1390 train_time:246396ms step_avg:nanms
step:8/1390 train_time:246529ms step_avg:nanms
step:9/1390 train_time:246662ms step_avg:nanms
step:10/1390 train_time:246800ms step_avg:nanms
step:11/1390 train_time:135ms step_avg:nanms
step:12/1390 train_time:272ms step_avg:nanms
step:13/1390 train_time:406ms step_avg:135.28ms
step:14/1390 train_time:540ms step_avg:134.94ms
step:15/1390 train_time:673ms step_avg:134.61ms
step:16/1390 train_time:808ms step_avg:134.61ms
step:17/1390 train_time:942ms step_avg:134.60ms
step:18/1390 train_time:1078ms step_avg:134.70ms
step:19/1390 train_time:1212ms step_avg:134.64ms
step:20/1390 train_time:1347ms step_avg:134.74ms
step:21/1390 train_time:1481ms step_avg:134.64ms
step:22/1390 train_time:1616ms step_avg:134.64ms
step:23/1390 train_time:1751ms step_avg:134.66ms
step:24/1390 train_time:1884ms step_avg:134.59ms
step:25/1390 train_time:2019ms step_avg:134.59ms
step:26/1390 train_time:2153ms step_avg:134.59ms
step:27/1390 train_time:2288ms step_avg:134.60ms
step:28/1390 train_time:2423ms step_avg:134.62ms
step:29/1390 train_time:2557ms step_avg:134.60ms
step:30/1390 train_time:2691ms step_avg:134.57ms
step:31/1390 train_time:2826ms step_avg:134.58ms
step:32/1390 train_time:2959ms step_avg:134.51ms
step:33/1390 train_time:3094ms step_avg:134.53ms
step:34/1390 train_time:3230ms step_avg:134.58ms
step:35/1390 train_time:3363ms step_avg:134.53ms
step:36/1390 train_time:3497ms step_avg:134.52ms
step:37/1390 train_time:3632ms step_avg:134.50ms
step:38/1390 train_time:3765ms step_avg:134.46ms
step:39/1390 train_time:3899ms step_avg:134.46ms
step:40/1390 train_time:4034ms step_avg:134.47ms
step:41/1390 train_time:4170ms step_avg:134.52ms
step:42/1390 train_time:4305ms step_avg:134.54ms
step:43/1390 train_time:4442ms step_avg:134.60ms
step:44/1390 train_time:4577ms step_avg:134.62ms
step:45/1390 train_time:4711ms step_avg:134.60ms
step:46/1390 train_time:4847ms step_avg:134.63ms
step:47/1390 train_time:4982ms step_avg:134.65ms
step:48/1390 train_time:5117ms step_avg:134.66ms
step:49/1390 train_time:5252ms step_avg:134.66ms
step:50/1390 train_time:5387ms step_avg:134.68ms
step:51/1390 train_time:5521ms step_avg:134.67ms
step:52/1390 train_time:5655ms step_avg:134.64ms
step:53/1390 train_time:5789ms step_avg:134.63ms
step:54/1390 train_time:5925ms step_avg:134.67ms
step:55/1390 train_time:6059ms step_avg:134.65ms
step:56/1390 train_time:6194ms step_avg:134.66ms
step:57/1390 train_time:6330ms step_avg:134.68ms
step:58/1390 train_time:6465ms step_avg:134.68ms
step:59/1390 train_time:6600ms step_avg:134.70ms
step:60/1390 train_time:6734ms step_avg:134.68ms
step:61/1390 train_time:6870ms step_avg:134.71ms
step:62/1390 train_time:7004ms step_avg:134.70ms
step:63/1390 train_time:7140ms step_avg:134.72ms
step:64/1390 train_time:7275ms step_avg:134.73ms
step:65/1390 train_time:7412ms step_avg:134.76ms
step:66/1390 train_time:7544ms step_avg:134.72ms
step:67/1390 train_time:7679ms step_avg:134.71ms
step:68/1390 train_time:7814ms step_avg:134.73ms
step:69/1390 train_time:7951ms step_avg:134.77ms
step:70/1390 train_time:8086ms step_avg:134.76ms
step:71/1390 train_time:8221ms step_avg:134.77ms
step:72/1390 train_time:8356ms step_avg:134.77ms
step:73/1390 train_time:8491ms step_avg:134.77ms
step:74/1390 train_time:8624ms step_avg:134.75ms
step:75/1390 train_time:8758ms step_avg:134.73ms
step:76/1390 train_time:8893ms step_avg:134.74ms
step:77/1390 train_time:9031ms step_avg:134.79ms
step:78/1390 train_time:9166ms step_avg:134.80ms
step:79/1390 train_time:9301ms step_avg:134.80ms
step:80/1390 train_time:9436ms step_avg:134.79ms
step:81/1390 train_time:9572ms step_avg:134.81ms
step:82/1390 train_time:9707ms step_avg:134.82ms
step:83/1390 train_time:9842ms step_avg:134.82ms
step:84/1390 train_time:9977ms step_avg:134.82ms
step:85/1390 train_time:10113ms step_avg:134.84ms
step:86/1390 train_time:10250ms step_avg:134.86ms
step:87/1390 train_time:10384ms step_avg:134.86ms
step:88/1390 train_time:10519ms step_avg:134.86ms
step:89/1390 train_time:10654ms step_avg:134.86ms
step:90/1390 train_time:10789ms step_avg:134.87ms
step:91/1390 train_time:10925ms step_avg:134.87ms
step:92/1390 train_time:11058ms step_avg:134.86ms
step:93/1390 train_time:11194ms step_avg:134.87ms
step:94/1390 train_time:11330ms step_avg:134.88ms
step:95/1390 train_time:11464ms step_avg:134.87ms
step:96/1390 train_time:11598ms step_avg:134.86ms
step:97/1390 train_time:11734ms step_avg:134.87ms
step:98/1390 train_time:11869ms step_avg:134.88ms
step:99/1390 train_time:12003ms step_avg:134.87ms
step:100/1390 train_time:12138ms step_avg:134.87ms
step:101/1390 train_time:12273ms step_avg:134.87ms
step:102/1390 train_time:12408ms step_avg:134.87ms
step:103/1390 train_time:12542ms step_avg:134.86ms
step:104/1390 train_time:12677ms step_avg:134.86ms
step:105/1390 train_time:12815ms step_avg:134.89ms
step:106/1390 train_time:12954ms step_avg:134.93ms
step:107/1390 train_time:13091ms step_avg:134.96ms
step:108/1390 train_time:13229ms step_avg:134.99ms
step:109/1390 train_time:13364ms step_avg:134.99ms
step:110/1390 train_time:13502ms step_avg:135.02ms
step:111/1390 train_time:13638ms step_avg:135.03ms
step:112/1390 train_time:13776ms step_avg:135.05ms
step:113/1390 train_time:13913ms step_avg:135.08ms
step:114/1390 train_time:14053ms step_avg:135.13ms
step:115/1390 train_time:14191ms step_avg:135.16ms
step:116/1390 train_time:14329ms step_avg:135.18ms
step:117/1390 train_time:14465ms step_avg:135.18ms
step:118/1390 train_time:14601ms step_avg:135.19ms
step:119/1390 train_time:14737ms step_avg:135.21ms
step:120/1390 train_time:14877ms step_avg:135.24ms
step:121/1390 train_time:15016ms step_avg:135.28ms
step:122/1390 train_time:15155ms step_avg:135.31ms
step:123/1390 train_time:15294ms step_avg:135.34ms
step:124/1390 train_time:15431ms step_avg:135.36ms
step:125/1390 train_time:15568ms step_avg:135.37ms
step:125/1390 val_loss:4.3686 train_time:15634ms step_avg:135.95ms
step:126/1390 train_time:15707ms step_avg:135.41ms
step:127/1390 train_time:15848ms step_avg:135.45ms
step:128/1390 train_time:15988ms step_avg:135.49ms
step:129/1390 train_time:16125ms step_avg:135.50ms
step:130/1390 train_time:16263ms step_avg:135.52ms
step:131/1390 train_time:16401ms step_avg:135.54ms
step:132/1390 train_time:16537ms step_avg:135.55ms
step:133/1390 train_time:16675ms step_avg:135.57ms
step:134/1390 train_time:16811ms step_avg:135.58ms
step:135/1390 train_time:16949ms step_avg:135.59ms
step:136/1390 train_time:17088ms step_avg:135.62ms
step:137/1390 train_time:17226ms step_avg:135.64ms
step:138/1390 train_time:17364ms step_avg:135.66ms
step:139/1390 train_time:17502ms step_avg:135.68ms
step:140/1390 train_time:17640ms step_avg:135.69ms
step:141/1390 train_time:17777ms step_avg:135.70ms
step:142/1390 train_time:17913ms step_avg:135.71ms
step:143/1390 train_time:18050ms step_avg:135.71ms
step:144/1390 train_time:18188ms step_avg:135.73ms
step:145/1390 train_time:18326ms step_avg:135.75ms
step:146/1390 train_time:18466ms step_avg:135.78ms
step:147/1390 train_time:18605ms step_avg:135.80ms
step:148/1390 train_time:18743ms step_avg:135.82ms
step:149/1390 train_time:18880ms step_avg:135.83ms
step:150/1390 train_time:19019ms step_avg:135.85ms
step:151/1390 train_time:19155ms step_avg:135.85ms
step:152/1390 train_time:19293ms step_avg:135.87ms
step:153/1390 train_time:19431ms step_avg:135.88ms
step:154/1390 train_time:19569ms step_avg:135.89ms
step:155/1390 train_time:19707ms step_avg:135.91ms
step:156/1390 train_time:19846ms step_avg:135.93ms
step:157/1390 train_time:19984ms step_avg:135.95ms
step:158/1390 train_time:20123ms step_avg:135.96ms
step:159/1390 train_time:20261ms step_avg:135.98ms
step:160/1390 train_time:20399ms step_avg:135.99ms
step:161/1390 train_time:20535ms step_avg:136.00ms
step:162/1390 train_time:20673ms step_avg:136.01ms
step:163/1390 train_time:20810ms step_avg:136.02ms
step:164/1390 train_time:20948ms step_avg:136.03ms
step:165/1390 train_time:21088ms step_avg:136.05ms
step:166/1390 train_time:21227ms step_avg:136.07ms
step:167/1390 train_time:21365ms step_avg:136.08ms
step:168/1390 train_time:21503ms step_avg:136.09ms
step:169/1390 train_time:21642ms step_avg:136.11ms
step:170/1390 train_time:21780ms step_avg:136.13ms
step:171/1390 train_time:21919ms step_avg:136.14ms
step:172/1390 train_time:22056ms step_avg:136.15ms
step:173/1390 train_time:22196ms step_avg:136.17ms
step:174/1390 train_time:22335ms step_avg:136.19ms
step:175/1390 train_time:22473ms step_avg:136.20ms
step:176/1390 train_time:22610ms step_avg:136.20ms
step:177/1390 train_time:22747ms step_avg:136.21ms
step:178/1390 train_time:22886ms step_avg:136.23ms
step:179/1390 train_time:23025ms step_avg:136.24ms
step:180/1390 train_time:23164ms step_avg:136.26ms
step:181/1390 train_time:23303ms step_avg:136.28ms
step:182/1390 train_time:23441ms step_avg:136.29ms
step:183/1390 train_time:23579ms step_avg:136.30ms
step:184/1390 train_time:23717ms step_avg:136.30ms
step:185/1390 train_time:23855ms step_avg:136.31ms
step:186/1390 train_time:23993ms step_avg:136.32ms
step:187/1390 train_time:24131ms step_avg:136.33ms
step:188/1390 train_time:24270ms step_avg:136.35ms
step:189/1390 train_time:24409ms step_avg:136.36ms
step:190/1390 train_time:24548ms step_avg:136.38ms
step:191/1390 train_time:24732ms step_avg:136.64ms
step:192/1390 train_time:24869ms step_avg:136.64ms
step:193/1390 train_time:25006ms step_avg:136.65ms
step:194/1390 train_time:25144ms step_avg:136.65ms
step:195/1390 train_time:25281ms step_avg:136.65ms
step:196/1390 train_time:25418ms step_avg:136.65ms
step:197/1390 train_time:25555ms step_avg:136.66ms
step:198/1390 train_time:25696ms step_avg:136.68ms
step:199/1390 train_time:25836ms step_avg:136.70ms
step:200/1390 train_time:25974ms step_avg:136.71ms
step:201/1390 train_time:26111ms step_avg:136.71ms
step:202/1390 train_time:26249ms step_avg:136.71ms
step:203/1390 train_time:26386ms step_avg:136.71ms
step:204/1390 train_time:26524ms step_avg:136.72ms
step:205/1390 train_time:26664ms step_avg:136.74ms
step:206/1390 train_time:26804ms step_avg:136.76ms
step:207/1390 train_time:26943ms step_avg:136.77ms
step:208/1390 train_time:27085ms step_avg:136.79ms
step:209/1390 train_time:27226ms step_avg:136.81ms
step:210/1390 train_time:27366ms step_avg:136.83ms
step:211/1390 train_time:27507ms step_avg:136.85ms
step:212/1390 train_time:27647ms step_avg:136.86ms
step:213/1390 train_time:27788ms step_avg:136.89ms
step:214/1390 train_time:27929ms step_avg:136.91ms
step:215/1390 train_time:28070ms step_avg:136.93ms
step:216/1390 train_time:28211ms step_avg:136.94ms
step:217/1390 train_time:28350ms step_avg:136.96ms
step:218/1390 train_time:28490ms step_avg:136.97ms
step:219/1390 train_time:28630ms step_avg:136.99ms
step:220/1390 train_time:28770ms step_avg:137.00ms
step:221/1390 train_time:28913ms step_avg:137.03ms
step:222/1390 train_time:29052ms step_avg:137.04ms
step:223/1390 train_time:29194ms step_avg:137.06ms
step:224/1390 train_time:29334ms step_avg:137.08ms
step:225/1390 train_time:29475ms step_avg:137.09ms
step:226/1390 train_time:29614ms step_avg:137.10ms
step:227/1390 train_time:29754ms step_avg:137.12ms
step:228/1390 train_time:29895ms step_avg:137.13ms
step:229/1390 train_time:30036ms step_avg:137.15ms
step:230/1390 train_time:30179ms step_avg:137.18ms
step:231/1390 train_time:30321ms step_avg:137.20ms
step:232/1390 train_time:30460ms step_avg:137.21ms
step:233/1390 train_time:30600ms step_avg:137.22ms
step:234/1390 train_time:30741ms step_avg:137.24ms
step:235/1390 train_time:30881ms step_avg:137.25ms
step:236/1390 train_time:31021ms step_avg:137.26ms
step:237/1390 train_time:31164ms step_avg:137.29ms
step:238/1390 train_time:31306ms step_avg:137.31ms
step:239/1390 train_time:31447ms step_avg:137.32ms
step:240/1390 train_time:31587ms step_avg:137.33ms
step:241/1390 train_time:31727ms step_avg:137.35ms
step:242/1390 train_time:31868ms step_avg:137.36ms
step:243/1390 train_time:32008ms step_avg:137.37ms
step:244/1390 train_time:32150ms step_avg:137.39ms
step:245/1390 train_time:32292ms step_avg:137.41ms
step:246/1390 train_time:32433ms step_avg:137.43ms
step:247/1390 train_time:32573ms step_avg:137.44ms
step:248/1390 train_time:32713ms step_avg:137.45ms
step:249/1390 train_time:32854ms step_avg:137.47ms
step:250/1390 train_time:32996ms step_avg:137.48ms
step:250/1390 val_loss:3.9427 train_time:33065ms step_avg:137.77ms
step:251/1390 train_time:33138ms step_avg:137.50ms
step:252/1390 train_time:33283ms step_avg:137.53ms
step:253/1390 train_time:33426ms step_avg:137.56ms
step:254/1390 train_time:33567ms step_avg:137.57ms
step:255/1390 train_time:33706ms step_avg:137.58ms
step:256/1390 train_time:33846ms step_avg:137.59ms
step:257/1390 train_time:33987ms step_avg:137.60ms
step:258/1390 train_time:34129ms step_avg:137.62ms
step:259/1390 train_time:34271ms step_avg:137.63ms
step:260/1390 train_time:34413ms step_avg:137.65ms
step:261/1390 train_time:34555ms step_avg:137.67ms
step:262/1390 train_time:34695ms step_avg:137.68ms
step:263/1390 train_time:34835ms step_avg:137.69ms
step:264/1390 train_time:34975ms step_avg:137.70ms
step:265/1390 train_time:35117ms step_avg:137.71ms
step:266/1390 train_time:35258ms step_avg:137.73ms
step:267/1390 train_time:35399ms step_avg:137.74ms
step:268/1390 train_time:35539ms step_avg:137.75ms
step:269/1390 train_time:35682ms step_avg:137.77ms
step:270/1390 train_time:35823ms step_avg:137.78ms
step:271/1390 train_time:35964ms step_avg:137.79ms
step:272/1390 train_time:36104ms step_avg:137.80ms
step:273/1390 train_time:36244ms step_avg:137.81ms
step:274/1390 train_time:36384ms step_avg:137.82ms
step:275/1390 train_time:36526ms step_avg:137.83ms
step:276/1390 train_time:36666ms step_avg:137.84ms
step:277/1390 train_time:36807ms step_avg:137.85ms
step:278/1390 train_time:36947ms step_avg:137.86ms
step:279/1390 train_time:37087ms step_avg:137.87ms
step:280/1390 train_time:37227ms step_avg:137.88ms
step:281/1390 train_time:37368ms step_avg:137.89ms
step:282/1390 train_time:37510ms step_avg:137.90ms
step:283/1390 train_time:37650ms step_avg:137.91ms
step:284/1390 train_time:37792ms step_avg:137.93ms
step:285/1390 train_time:37933ms step_avg:137.94ms
step:286/1390 train_time:38074ms step_avg:137.95ms
step:287/1390 train_time:38214ms step_avg:137.96ms
step:288/1390 train_time:38356ms step_avg:137.97ms
step:289/1390 train_time:38497ms step_avg:137.98ms
step:290/1390 train_time:38638ms step_avg:137.99ms
step:291/1390 train_time:38778ms step_avg:138.00ms
step:292/1390 train_time:38919ms step_avg:138.01ms
step:293/1390 train_time:39061ms step_avg:138.02ms
step:294/1390 train_time:39202ms step_avg:138.04ms
step:295/1390 train_time:39342ms step_avg:138.04ms
step:296/1390 train_time:39482ms step_avg:138.05ms
step:297/1390 train_time:39623ms step_avg:138.06ms
step:298/1390 train_time:39763ms step_avg:138.06ms
step:299/1390 train_time:39903ms step_avg:138.07ms
step:300/1390 train_time:40044ms step_avg:138.08ms
step:301/1390 train_time:40185ms step_avg:138.09ms
step:302/1390 train_time:40328ms step_avg:138.11ms
step:303/1390 train_time:40468ms step_avg:138.12ms
step:304/1390 train_time:40610ms step_avg:138.13ms
step:305/1390 train_time:40750ms step_avg:138.14ms
step:306/1390 train_time:40891ms step_avg:138.15ms
step:307/1390 train_time:41033ms step_avg:138.16ms
step:308/1390 train_time:41173ms step_avg:138.16ms
step:309/1390 train_time:41314ms step_avg:138.17ms
step:310/1390 train_time:41456ms step_avg:138.19ms
step:311/1390 train_time:41599ms step_avg:138.20ms
step:312/1390 train_time:41741ms step_avg:138.22ms
step:313/1390 train_time:41884ms step_avg:138.23ms
step:314/1390 train_time:42025ms step_avg:138.24ms
step:315/1390 train_time:42170ms step_avg:138.26ms
step:316/1390 train_time:42313ms step_avg:138.28ms
step:317/1390 train_time:42455ms step_avg:138.29ms
step:318/1390 train_time:42597ms step_avg:138.30ms
step:319/1390 train_time:42739ms step_avg:138.32ms
step:320/1390 train_time:42882ms step_avg:138.33ms
step:321/1390 train_time:43024ms step_avg:138.34ms
step:322/1390 train_time:43169ms step_avg:138.36ms
step:323/1390 train_time:43313ms step_avg:138.38ms
step:324/1390 train_time:43455ms step_avg:138.39ms
step:325/1390 train_time:43598ms step_avg:138.41ms
step:326/1390 train_time:43740ms step_avg:138.42ms
step:327/1390 train_time:43882ms step_avg:138.43ms
step:328/1390 train_time:44026ms step_avg:138.45ms
step:329/1390 train_time:44169ms step_avg:138.46ms
step:330/1390 train_time:44313ms step_avg:138.48ms
step:331/1390 train_time:44455ms step_avg:138.49ms
step:332/1390 train_time:44598ms step_avg:138.50ms
step:333/1390 train_time:44740ms step_avg:138.51ms
step:334/1390 train_time:44883ms step_avg:138.53ms
step:335/1390 train_time:45026ms step_avg:138.54ms
step:336/1390 train_time:45170ms step_avg:138.56ms
step:337/1390 train_time:45314ms step_avg:138.57ms
step:338/1390 train_time:45457ms step_avg:138.59ms
step:339/1390 train_time:45599ms step_avg:138.60ms
step:340/1390 train_time:45741ms step_avg:138.61ms
step:341/1390 train_time:45885ms step_avg:138.63ms
step:342/1390 train_time:46027ms step_avg:138.64ms
step:343/1390 train_time:46171ms step_avg:138.65ms
step:344/1390 train_time:46316ms step_avg:138.67ms
step:345/1390 train_time:46459ms step_avg:138.68ms
step:346/1390 train_time:46601ms step_avg:138.69ms
step:347/1390 train_time:46745ms step_avg:138.71ms
step:348/1390 train_time:46887ms step_avg:138.72ms
step:349/1390 train_time:47031ms step_avg:138.73ms
step:350/1390 train_time:47174ms step_avg:138.75ms
step:351/1390 train_time:47317ms step_avg:138.76ms
step:352/1390 train_time:47459ms step_avg:138.77ms
step:353/1390 train_time:47604ms step_avg:138.79ms
step:354/1390 train_time:47746ms step_avg:138.80ms
step:355/1390 train_time:47890ms step_avg:138.81ms
step:356/1390 train_time:48034ms step_avg:138.83ms
step:357/1390 train_time:48177ms step_avg:138.84ms
step:358/1390 train_time:48320ms step_avg:138.85ms
step:359/1390 train_time:48464ms step_avg:138.87ms
step:360/1390 train_time:48608ms step_avg:138.88ms
step:361/1390 train_time:48751ms step_avg:138.89ms
step:362/1390 train_time:48894ms step_avg:138.90ms
step:363/1390 train_time:49037ms step_avg:138.91ms
step:364/1390 train_time:49180ms step_avg:138.93ms
step:365/1390 train_time:49323ms step_avg:138.94ms
step:366/1390 train_time:49465ms step_avg:138.95ms
step:367/1390 train_time:49609ms step_avg:138.96ms
step:368/1390 train_time:49751ms step_avg:138.97ms
step:369/1390 train_time:49894ms step_avg:138.98ms
step:370/1390 train_time:50035ms step_avg:138.99ms
step:371/1390 train_time:50178ms step_avg:139.00ms
step:372/1390 train_time:50320ms step_avg:139.01ms
step:373/1390 train_time:50464ms step_avg:139.02ms
step:374/1390 train_time:50609ms step_avg:139.03ms
step:375/1390 train_time:50752ms step_avg:139.05ms
step:375/1390 val_loss:3.7671 train_time:50822ms step_avg:139.24ms
step:376/1390 train_time:50897ms step_avg:139.06ms
step:377/1390 train_time:51044ms step_avg:139.08ms
step:378/1390 train_time:51186ms step_avg:139.09ms
step:379/1390 train_time:51329ms step_avg:139.10ms
step:380/1390 train_time:51471ms step_avg:139.11ms
step:381/1390 train_time:51665ms step_avg:139.26ms
step:382/1390 train_time:51807ms step_avg:139.27ms