-
Notifications
You must be signed in to change notification settings - Fork 182
/
625a6fcc-203c-4545-b697-0b8daa2b6d07.txt
2133 lines (2066 loc) · 106 KB
/
625a6fcc-203c-4545-b697-0b8daa2b6d07.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
from dataclasses import dataclass
from pathlib import Path
import torch
from torch import nn
import torch.nn.functional as F
import torch.distributed as dist
import torch._inductor.config as config
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
def zeropower_via_svd(G, steps=None):
U, S, V = G.svd()
return U @ V.T
@torch.compile
def zeropower_via_newtonschulz5(G, steps=10, eps=1e-7):
"""
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()
X /= (X.norm() + eps) # ensure top singular value <= 1
if G.size(0) > G.size(1):
X = X.T
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
zeropower_backends = dict(svd=zeropower_via_svd, newtonschulz5=zeropower_via_newtonschulz5)
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)
backend: The chosen backend for the orthogonalization step. (recommended: 'newtonschulz5')
backend_steps: The number of iteration steps to use in the backend, if it is iterative.
"""
def __init__(self, params, lr=0.02, momentum=0.95, nesterov=True,
backend='newtonschulz5', backend_steps=5):
self.num_process = int(os.environ['WORLD_SIZE'])
self.rank = int(os.environ["RANK"])
defaults = dict(lr=lr, momentum=momentum, nesterov=nesterov, backend=backend, backend_steps=backend_steps)
params: "list[torch.Tensor]" = list(params)
assert all(isinstance(p, torch.Tensor) for p in params)
sizes = {p.numel() for p in params}
param_groups = [
{
"params": [p for p in params if p.numel() == size],
"update_buffer": [
torch.empty(size, device="cuda", dtype=torch.bfloat16)
for _ in range(self.num_process)
],
}
for size in sizes
]
super().__init__(param_groups, defaults)
def step(self):
for group in self.param_groups:
lr: float = group["lr"]
momentum: float = group["momentum"]
nesterov: bool = group["nesterov"]
zeropower_backend = zeropower_backends[group["backend"]]
backend_steps: int = group["backend_steps"]
update_buffers: "list[torch.Tensor]" = group["update_buffer"]
# generate weight updates in distributed fashion
params: "list[torch.Tensor]" = group["params"]
assert len(params) % self.num_process == 0
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.num_process]:
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: torch.Tensor = state["momentum_buffer"]
buf.lerp_(g, 1 - momentum)
g = g.lerp_(buf, momentum) if nesterov else buf
g = zeropower_backend(g, steps=backend_steps).flatten()
update_prev()
handle = dist.all_gather(update_buffers, g, async_op=True)
params_world = params[base_i : base_i + self.num_process]
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.to(x.dtype))
class Rotary(torch.nn.Module):
def __init__(self, dim, base=10000):
super().__init__()
self.register_buffer('inv_freq', (1 / base) ** (torch.arange(0, dim, 2) / dim))
self.seq_len_cached = None
self.cos_cached = None
self.sin_cached = None
def forward(self, x):
seq_len = x.shape[1]
if seq_len != self.seq_len_cached:
t = torch.arange(seq_len, device=x.device)
freqs = torch.outer(t, self.inv_freq)
self.seq_len_cached = seq_len
self.cos_cached = freqs.cos()
self.sin_cached = freqs.sin()
cos, sin = self.cos_cached[None, :, None, :], self.sin_cached[None, :, None, :]
# apply_rotary_emb(x, cos, sin)
x1, x2 = x.chunk(2, dim=3)
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, n_head):
super().__init__()
assert dim % n_head == 0
self.n_head = n_head
self.c_q = CastedLinear(dim, dim)
self.c_k = CastedLinear(dim, dim)
self.c_v = CastedLinear(dim, dim)
# value residual lambda
self.lambdas = nn.Parameter(torch.tensor([0.5, 0.5])) # @Grad62304977
# rotary embeddings
self.rotary = Rotary(dim // n_head) # dim // n_head = head_dim
# output projection
self.c_proj = CastedLinear(dim, dim)
self.c_proj.weight.data.zero_() # zero init suggested by @Grad62304977
def forward(self, x: torch.Tensor, vi: torch.Tensor, block_mask: BlockMask) -> torch.Tensor:
B, T = x.size(0), x.size(1) # batch size, sequence length
assert B == 1, "Must use batch size = 1 for FlexAttention"
q: torch.Tensor = self.c_q(x).view(B, T, self.n_head, -1)
k: torch.Tensor = self.c_k(x).view(B, T, self.n_head, -1)
v: torch.Tensor = self.c_v(x).view(B, T, self.n_head, -1)
v = self.lambdas[0] * v + self.lambdas[1] * vi.view_as(v) # @Grad62304977
q, k = norm(q), norm(k) # QK norm suggested by @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: int):
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: torch.Tensor) -> torch.Tensor:
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, config):
super().__init__()
self.attn = CausalSelfAttention(config.n_embd, config.n_head)
self.mlp = MLP(config.n_embd)
self.lambdas = nn.Parameter(torch.tensor([1., 0.]))
def forward(self, x: torch.Tensor, vi: torch.Tensor, x0: torch.Tensor, block_mask: BlockMask) -> torch.Tensor:
x = self.lambdas[0] * x + self.lambdas[1] * x0
x = x + self.attn(norm(x), vi, block_mask)
x = x + self.mlp(norm(x))
return x
# -----------------------------------------------------------------------------
# The main GPT-2 model
@dataclass
class GPTConfig:
vocab_size : int = 50304
n_layer : int = 12
n_head : int = 6 # head dim 128 suggested by @Grad62304977
n_embd : int = 768
lm_head_softcap : int = 30
class GPT(nn.Module):
def __init__(self, config: GPTConfig):
super().__init__()
self.n_layer = config.n_layer
self.lm_head_softcap = config.lm_head_softcap
# U-net design by @brendanh0gan
self.num_encoder_layers = config.n_layer // 2 # Half of the layers for encoder
self.num_decoder_layers = config.n_layer - 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))
self.transformer = nn.ModuleDict(dict(
wte = nn.Embedding(config.vocab_size, config.n_embd),
# token value embeddings by @KoszarskyB - inspired by @Grad62304977's value residual learning
# U-net structure on token value embeddings by @leloykun
vte = nn.Embedding(config.vocab_size, config.n_embd*self.num_encoder_layers),
h = nn.ModuleList([Block(config) for _ in range(config.n_layer)]),
))
self.lm_head = CastedLinear(config.n_embd, config.vocab_size)
self.lm_head.weight.data.zero_() # @Grad62304977
def forward(self, idx: torch.Tensor, target: torch.Tensor, sliding_window: torch.Tensor) -> torch.Tensor:
BLOCK_SIZE = 128
assert idx.ndim == 1
docs = (idx == 50256).cumsum(0)
docs_low = docs.reshape(-1, BLOCK_SIZE)[:, 0].contiguous()
docs_high = docs.reshape(-1, BLOCK_SIZE)[:, -1].contiguous()
def document_sliding_window_causal(b, h, q_idx, kv_idx):
causal_mask = q_idx >= kv_idx
document_mask = docs[q_idx] == docs[kv_idx]
window_mask = q_idx - kv_idx < sliding_window
return causal_mask & document_mask & window_mask
S = len(idx)
def create_sliding_window_causal_mask(S: int, sliding_window: torch.Tensor):
kv_idx = block_idx = torch.arange(S // BLOCK_SIZE, dtype=torch.int32, device="cuda")
q_idx = block_idx[:, None]
causal_mask = q_idx >= kv_idx
document_mask = (docs_low[q_idx] <= docs_high[kv_idx]) & (docs_low[kv_idx] <= docs_high[q_idx])
window_mask = q_idx - kv_idx < ((sliding_window + BLOCK_SIZE - 1) // BLOCK_SIZE)
dense_mask = causal_mask & document_mask & window_mask
dense_mask = dense_mask.to(torch.int32)
num_blocks = dense_mask.sum(dim=-1).to(torch.int32)
indices = torch.argsort(dense_mask, dim=-1, descending=True, stable=True).to(torch.int32)
num_blocks = num_blocks[None, None, :].contiguous()
indices = indices[None, None, :].contiguous()
return BlockMask.from_kv_blocks(num_blocks, indices, BLOCK_SIZE=BLOCK_SIZE, mask_mod=document_sliding_window_causal)
block_mask = create_sliding_window_causal_mask(S, sliding_window)
# forward the GPT model itself
x = self.transformer.wte(idx[None]) # token embeddings of shape (b, t, n_embd)
x = norm(x) # @Grad62304977
x0 = x
vi = self.transformer.vte(idx[None]).chunk(self.num_encoder_layers, dim=-1)
# 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.transformer.h[i](x, vi[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.transformer.h[self.num_encoder_layers + i](x, vi[self.num_encoder_layers-1-i], x0, block_mask)
x = norm(x)
logits = self.lm_head(x)
logits = self.lm_head_softcap * torch.tanh(logits / self.lm_head_softcap) # @Grad62304977
logits = logits.float()
loss = F.cross_entropy(logits.view(-1, logits.size(-1)), target.view(-1))
return loss
# -----------------------------------------------------------------------------
# Our own simple Distributed Data Loader
def _peek_data_shard(file: Path):
# only reads the header, returns header data
# header is 256 int32
header = torch.from_file(f"{file}", False, 256, dtype=torch.int32)
assert header[0] == 20240520, "magic number mismatch in the data .bin file"
assert header[1] == 1, "unsupported version"
return int(header[2]) # number of tokens (claimed)
def _load_data_shard(file: Path, ntok: int):
with file.open("rb") as f:
tokens = torch.empty(ntok, dtype=torch.uint16, pin_memory=True)
f.seek(256 * 4)
nbytes = f.readinto(tokens.numpy())
assert nbytes == 2 * ntok, "number of tokens read does not match header?"
return tokens
class DistributedDataLoader:
def __init__(self, filename_pattern, T, process_rank, num_processes):
self.process_rank = process_rank
self.num_processes = num_processes
self.T = T
# glob files that match the pattern
self.files = sorted(Path.cwd().glob(filename_pattern))
assert len(self.files) > 0, f"did not find any files that match the pattern {filename_pattern}"
# load and validate all data shards, count number of tokens in total
self.ntoks = [_peek_data_shard(file) for file in self.files]
assert min(self.ntoks) >= num_processes * T + 1
self.ntok_total = sum(self.ntoks)
self.reset()
def reset(self):
self.current_shard = -1
self.advance()
def advance(self): # advance to next data shard
self.current_shard = (self.current_shard + 1) % len(self.files)
self.current_position = self.process_rank * self.T
self.tokens = _load_data_shard(self.files[self.current_shard], self.ntoks[self.current_shard])
def next_batch(self):
batch_size = self.T * self.num_processes
buf = self.tokens[self.current_position:self.current_position+self.T+1]
# host side async is sufficient;
# no performance improvement was observed when introducing a separate stream.
x = buf[:-1].to(device="cuda", dtype=torch.int32, non_blocking=True) # inputs
y = buf[1:].to(device="cuda", dtype=torch.int64, non_blocking=True) # targets
# advance current position and load next shard if necessary
self.current_position += batch_size
if self.current_position + batch_size + 1 >= len(self.tokens):
self.advance()
return x, y
# -----------------------------------------------------------------------------
# int main
@dataclass
class Hyperparameters:
# data hyperparams
input_bin : str = 'data/fineweb10B/fineweb_train_*.bin' # input .bin to train on
input_val_bin : str = 'data/fineweb10B/fineweb_val_*.bin' # input .bin to eval validation loss on
# optimization hyperparams
batch_size : int = 8 # batch size, in sequences, across all devices
sequence_length : int = 64*1024 # sequence length, in tokens
num_iterations : int = 1480 # number of iterations to run
warmup_iters : int = 0
cooldown_iters : int = 600 # number of iterations of linear warmup/cooldown for triangular or trapezoidal schedule
weight_decay : float = 0
# evaluation and logging hyperparams
val_loss_every : int = 125 # every how many steps to evaluate val loss? 0 for only at the end
val_tokens : int = 10485760 # how many tokens of validation data? it's important to keep this fixed for consistent comparisons
save_every : int = 0 # every how many steps to save the checkpoint? 0 for only at the end
args = Hyperparameters()
# set up DDP (distributed data parallel). torchrun sets this env variable
assert torch.cuda.is_available()
dist.init_process_group(backend='nccl')
ddp_rank = int(os.environ['RANK'])
ddp_local_rank = int(os.environ['LOCAL_RANK'])
ddp_world_size = int(os.environ['WORLD_SIZE'])
device = f'cuda:{ddp_local_rank}'
torch.cuda.set_device(device)
print(f"using device: {device}")
master_process = (ddp_rank == 0) # this process will do logging, checkpointing etc.
# begin logging
logfile = None
if master_process:
run_id = str(uuid.uuid4())
logdir = 'logs/%s/' % run_id
# os.makedirs(logdir, exist_ok=True)
logfile = 'logs/%s.txt' % run_id
# create the log file
with open(logfile, "w") as f:
# begin the log by printing this file (the Python code)
f.write(code)
f.write('='*100 + '\n')
def print0(s, logonly=False):
if master_process:
with open(logfile, "a") as f:
if not logonly:
print(s)
f.write(s+'\n')
# log information about the hardware/software environment this is running on
# and print the full `nvidia-smi` to file
print0(f"Running pytorch {torch.version.__version__} compiled for CUDA {torch.version.cuda}\nnvidia-smi:")
import subprocess
result = subprocess.run(['nvidia-smi'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
print0(f'{result.stdout}', logonly=True)
print0('='*100, logonly=True)
# convenience variables
T = args.sequence_length
# calculate the number of steps to take in the val loop.
assert args.val_tokens % (T * ddp_world_size) == 0
val_steps = args.val_tokens // (T * ddp_world_size)
# calculate the steps of gradient accumulation required to attain the desired global batch size.
assert args.batch_size % (ddp_world_size) == 0
train_accumulation_steps = args.batch_size // ddp_world_size
assert train_accumulation_steps == 1
# load tokens
train_loader = DistributedDataLoader(args.input_bin, T, ddp_rank, ddp_world_size)
val_loader = DistributedDataLoader(args.input_val_bin, T, ddp_rank, ddp_world_size)
print0(f"Training DataLoader: total number of tokens: {train_loader.ntok_total} across {len(train_loader.files)} files")
print0(f"Validation DataLoader: total number of tokens: {val_loader.ntok_total} across {len(val_loader.files)} files")
print0('='*100, logonly=True)
x, y = train_loader.next_batch()
# 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.
num_vocab = 50304
model = GPT(GPTConfig(vocab_size=num_vocab, n_layer=12, n_head=6, n_embd=768))
model = model.cuda().bfloat16()
for m in model.modules():
if isinstance(m, CastedLinear):
m.float()
if hasattr(config, "coordinate_descent_tuning"):
config.coordinate_descent_tuning = True # suggested by @Chillee
model = torch.compile(model)
# here we wrap model into DDP container
model = DDP(model, device_ids=[ddp_local_rank])
raw_model = model.module # always contains the "raw" unwrapped model
# init the optimizer(s)
optimizer1 = torch.optim.Adam([raw_model.transformer.wte.weight, raw_model.transformer.vte.weight], lr=0.6, betas=(0.8, 0.95), fused=True)
optimizer2 = torch.optim.Adam([raw_model.lm_head.weight], lr=0.008, betas=(0.8, 0.95), fused=True)
params = list(raw_model.transformer.h.parameters())
matrix_params = [p for p in params if p.ndim == 2]
scalar_params = [p for p in params if p.ndim < 2] + [raw_model.skip_weights]
optimizer3 = Muon(matrix_params, lr=0.05, momentum=0.95)
optimizer4 = torch.optim.Adam(scalar_params, lr=0.04, betas=(0.8, 0.95), fused=True)
optimizers = [optimizer1, optimizer2, optimizer3, optimizer4]
# learning rate decay scheduler (linear warmup and cooldown)
def get_lr(it):
assert it <= args.num_iterations
# 1) linear warmup for warmup_iters steps
if it < args.warmup_iters:
return (it+1) / args.warmup_iters
# 2) constant lr for a while
elif it < args.num_iterations - args.cooldown_iters:
return 1.0
# 3) linear cooldown
else:
decay_ratio = (args.num_iterations - it) / args.cooldown_iters
return decay_ratio
schedulers = [torch.optim.lr_scheduler.LambdaLR(opt, get_lr) for opt in optimizers]
sliding_window_size = torch.tensor(64, dtype=torch.int32, device="cuda")
sw_size_prev = 64
# Start training loop
training_time_ms = 0
# start the clock
torch.cuda.synchronize()
t0 = time.perf_counter()
# begin training
for step in range(args.num_iterations + 1):
last_step = (step == args.num_iterations)
# 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
# Set the sliding window size for the current step, in chunks of 64. By @fernbear.bsky.social
sw_size = 64 * int((64 + (1792 - 64) * step / args.num_iterations) // 64)
if sw_size != sw_size_prev:
sliding_window_size.copy_(sw_size, non_blocking=True)
sw_size_prev = sw_size
# once in a while evaluate the validation dataset
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
for _ in range(val_steps):
with torch.no_grad():
x_val, y_val = val_loader.next_batch()
val_loss += model(x_val, y_val, sliding_window=sliding_window_size)
dist.all_reduce(val_loss, op=dist.ReduceOp.AVG)
val_loss /= val_steps
# log val loss to console and to logfile
print0(f'step:{step}/{args.num_iterations} val_loss:{val_loss:.4f} train_time:{training_time_ms:.0f}ms step_avg:{training_time_ms/(timed_steps-1):.2f}ms')
# start the clock again
torch.cuda.synchronize()
t0 = time.perf_counter()
if master_process and (last_step or (args.save_every > 0 and step % args.save_every == 0)):
# stop the clock
torch.cuda.synchronize()
training_time_ms += 1000 * (time.perf_counter() - t0)
# save the state of the training process
log = dict(step=step, code=code, model=raw_model.state_dict(), optimizers=[opt.state_dict() for opt in optimizers])
# torch.save(log, 'logs/%s/state_step%06d.pt' % (run_id, step))
# start the clock again
torch.cuda.synchronize()
t0 = time.perf_counter()
# bit confusing: we want to make sure to eval on 0th iteration
# but also after the very last iteration. so we loop for step <= num_iterations
# instead of just < num_iterations (one extra due to <=), only to do
# the validation/sampling one last time, and then we break right here as we're done.
if last_step:
break
# --------------- TRAINING SECTION BEGIN -----------------
model.train()
loss = model(x, y, sliding_window=sliding_window_size)
loss.backward()
del loss
# advance the dataset for the next batch
x, y = train_loader.next_batch()
# momentum warmup for Muon
frac = min(step/300, 1)
for group in optimizer3.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()
sched.step()
# null the gradients
model.zero_grad(set_to_none=True)
# --------------- TRAINING SECTION END -------------------
# everything that follows now is just diagnostics, prints, logging, etc.
approx_time = training_time_ms + 1000 * (time.perf_counter() - t0)
print0(f"step:{step+1}/{args.num_iterations} train_time:{approx_time:.0f}ms step_avg:{approx_time/timed_steps:.2f}ms")
if master_process:
print(f"peak memory consumption: {torch.cuda.max_memory_allocated() // 1024 // 1024} MiB")
# -------------------------------------------------------------------------
# clean up nice
dist.destroy_process_group()
====================================================================================================
Running pytorch 2.6.0.dev20241203+cu124 compiled for CUDA 12.4
nvidia-smi:
Sun Dec 8 10:15:24 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.129.03 Driver Version: 535.129.03 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:65:02.0 Off | 0 |
| N/A 36C P0 74W / 700W | 7MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+----------------------+----------------------+
| 1 NVIDIA H100 80GB HBM3 On | 00000000:67:02.0 Off | 0 |
| N/A 46C P0 131W / 700W | 533MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+----------------------+----------------------+
| 2 NVIDIA H100 80GB HBM3 On | 00000000:69:02.0 Off | 0 |
| N/A 45C P0 83W / 700W | 26MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+----------------------+----------------------+
| 3 NVIDIA H100 80GB HBM3 On | 00000000:6B:02.0 Off | 0 |
| N/A 39C P0 118W / 700W | 533MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+----------------------+----------------------+
| 4 NVIDIA H100 80GB HBM3 On | 00000000:6F:02.0 Off | 0 |
| N/A 39C P0 117W / 700W | 533MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+----------------------+----------------------+
| 5 NVIDIA H100 80GB HBM3 On | 00000000:71:02.0 Off | 0 |
| N/A 45C P0 93W / 700W | 26MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+----------------------+----------------------+
| 6 NVIDIA H100 80GB HBM3 On | 00000000:73:02.0 Off | 0 |
| N/A 46C P0 127W / 700W | 533MiB / 81559MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+----------------------+----------------------+
| 7 NVIDIA H100 80GB HBM3 On | 00000000:75:02.0 Off | 0 |
| N/A 38C P0 115W / 700W | 45MiB / 81559MiB | 1% Default |
| | | Disabled |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
+---------------------------------------------------------------------------------------+
====================================================================================================
Training DataLoader: total number of tokens: 3200000000 across 32 files
Validation DataLoader: total number of tokens: 100000000 across 1 files
====================================================================================================
step:0/1480 val_loss:10.8258 train_time:0ms step_avg:nanms
step:1/1480 train_time:22986ms step_avg:nanms
step:2/1480 train_time:23073ms step_avg:nanms
step:3/1480 train_time:23210ms step_avg:nanms
step:4/1480 train_time:23350ms step_avg:nanms
step:5/1480 train_time:23492ms step_avg:nanms
step:6/1480 train_time:23633ms step_avg:nanms
step:7/1480 train_time:23774ms step_avg:nanms
step:8/1480 train_time:23917ms step_avg:nanms
step:9/1480 train_time:24063ms step_avg:nanms
step:10/1480 train_time:24207ms step_avg:nanms
step:11/1480 train_time:140ms step_avg:nanms
step:12/1480 train_time:281ms step_avg:nanms
step:13/1480 train_time:424ms step_avg:141.31ms
step:14/1480 train_time:565ms step_avg:141.32ms
step:15/1480 train_time:707ms step_avg:141.42ms
step:16/1480 train_time:852ms step_avg:142.00ms
step:17/1480 train_time:997ms step_avg:142.49ms
step:18/1480 train_time:1139ms step_avg:142.43ms
step:19/1480 train_time:1280ms step_avg:142.26ms
step:20/1480 train_time:1422ms step_avg:142.20ms
step:21/1480 train_time:1564ms step_avg:142.16ms
step:22/1480 train_time:1708ms step_avg:142.32ms
step:23/1480 train_time:1851ms step_avg:142.39ms
step:24/1480 train_time:1996ms step_avg:142.60ms
step:25/1480 train_time:2139ms step_avg:142.62ms
step:26/1480 train_time:2282ms step_avg:142.60ms
step:27/1480 train_time:2423ms step_avg:142.56ms
step:28/1480 train_time:2566ms step_avg:142.53ms
step:29/1480 train_time:2708ms step_avg:142.55ms
step:30/1480 train_time:2852ms step_avg:142.62ms
step:31/1480 train_time:2998ms step_avg:142.75ms
step:32/1480 train_time:3140ms step_avg:142.74ms
step:33/1480 train_time:3282ms step_avg:142.68ms
step:34/1480 train_time:3424ms step_avg:142.66ms
step:35/1480 train_time:3566ms step_avg:142.62ms
step:36/1480 train_time:3707ms step_avg:142.56ms
step:37/1480 train_time:3848ms step_avg:142.52ms
step:38/1480 train_time:3993ms step_avg:142.59ms
step:39/1480 train_time:4136ms step_avg:142.63ms
step:40/1480 train_time:4279ms step_avg:142.62ms
step:41/1480 train_time:4422ms step_avg:142.64ms
step:42/1480 train_time:4565ms step_avg:142.65ms
step:43/1480 train_time:4708ms step_avg:142.66ms
step:44/1480 train_time:4852ms step_avg:142.71ms
step:45/1480 train_time:4997ms step_avg:142.77ms
step:46/1480 train_time:5139ms step_avg:142.76ms
step:47/1480 train_time:5281ms step_avg:142.74ms
step:48/1480 train_time:5425ms step_avg:142.76ms
step:49/1480 train_time:5569ms step_avg:142.79ms
step:50/1480 train_time:5712ms step_avg:142.80ms
step:51/1480 train_time:5854ms step_avg:142.79ms
step:52/1480 train_time:5998ms step_avg:142.80ms
step:53/1480 train_time:6140ms step_avg:142.79ms
step:54/1480 train_time:6281ms step_avg:142.76ms
step:55/1480 train_time:6425ms step_avg:142.77ms
step:56/1480 train_time:6567ms step_avg:142.76ms
step:57/1480 train_time:6711ms step_avg:142.79ms
step:58/1480 train_time:6855ms step_avg:142.82ms
step:59/1480 train_time:6999ms step_avg:142.83ms
step:60/1480 train_time:7141ms step_avg:142.82ms
step:61/1480 train_time:7282ms step_avg:142.79ms
step:62/1480 train_time:7425ms step_avg:142.78ms
step:63/1480 train_time:7569ms step_avg:142.82ms
step:64/1480 train_time:7716ms step_avg:142.89ms
step:65/1480 train_time:7860ms step_avg:142.90ms
step:66/1480 train_time:8001ms step_avg:142.88ms
step:67/1480 train_time:8142ms step_avg:142.85ms
step:68/1480 train_time:8286ms step_avg:142.86ms
step:69/1480 train_time:8430ms step_avg:142.88ms
step:70/1480 train_time:8573ms step_avg:142.88ms
step:71/1480 train_time:8717ms step_avg:142.91ms
step:72/1480 train_time:8860ms step_avg:142.90ms
step:73/1480 train_time:9002ms step_avg:142.89ms
step:74/1480 train_time:9144ms step_avg:142.88ms
step:75/1480 train_time:9289ms step_avg:142.90ms
step:76/1480 train_time:9432ms step_avg:142.91ms
step:77/1480 train_time:9575ms step_avg:142.91ms
step:78/1480 train_time:9719ms step_avg:142.93ms
step:79/1480 train_time:9861ms step_avg:142.91ms
step:80/1480 train_time:10001ms step_avg:142.88ms
step:81/1480 train_time:10142ms step_avg:142.85ms
step:82/1480 train_time:10284ms step_avg:142.84ms
step:83/1480 train_time:10428ms step_avg:142.85ms
step:84/1480 train_time:10572ms step_avg:142.86ms
step:85/1480 train_time:10715ms step_avg:142.86ms
step:86/1480 train_time:10857ms step_avg:142.86ms
step:87/1480 train_time:11000ms step_avg:142.86ms
step:88/1480 train_time:11141ms step_avg:142.83ms
step:89/1480 train_time:11282ms step_avg:142.82ms
step:90/1480 train_time:11426ms step_avg:142.83ms
step:91/1480 train_time:11571ms step_avg:142.85ms
step:92/1480 train_time:11715ms step_avg:142.86ms
step:93/1480 train_time:11857ms step_avg:142.86ms
step:94/1480 train_time:12000ms step_avg:142.86ms
step:95/1480 train_time:12141ms step_avg:142.84ms
step:96/1480 train_time:12284ms step_avg:142.84ms
step:97/1480 train_time:12427ms step_avg:142.84ms
step:98/1480 train_time:12572ms step_avg:142.86ms
step:99/1480 train_time:12718ms step_avg:142.90ms
step:100/1480 train_time:12860ms step_avg:142.89ms
step:101/1480 train_time:13001ms step_avg:142.87ms
step:102/1480 train_time:13142ms step_avg:142.85ms
step:103/1480 train_time:13286ms step_avg:142.86ms
step:104/1480 train_time:13431ms step_avg:142.89ms
step:105/1480 train_time:13575ms step_avg:142.90ms
step:106/1480 train_time:13719ms step_avg:142.91ms
step:107/1480 train_time:13862ms step_avg:142.90ms
step:108/1480 train_time:14005ms step_avg:142.91ms
step:109/1480 train_time:14147ms step_avg:142.90ms
step:110/1480 train_time:14291ms step_avg:142.91ms
step:111/1480 train_time:14438ms step_avg:142.95ms
step:112/1480 train_time:14584ms step_avg:142.99ms
step:113/1480 train_time:14733ms step_avg:143.04ms
step:114/1480 train_time:14880ms step_avg:143.08ms
step:115/1480 train_time:15025ms step_avg:143.10ms
step:116/1480 train_time:15173ms step_avg:143.14ms
step:117/1480 train_time:15320ms step_avg:143.18ms
step:118/1480 train_time:15466ms step_avg:143.21ms
step:119/1480 train_time:15615ms step_avg:143.26ms
step:120/1480 train_time:15762ms step_avg:143.29ms
step:121/1480 train_time:15909ms step_avg:143.32ms
step:122/1480 train_time:16056ms step_avg:143.35ms
step:123/1480 train_time:16202ms step_avg:143.38ms
step:124/1480 train_time:16349ms step_avg:143.41ms
step:125/1480 train_time:16498ms step_avg:143.46ms
step:125/1480 val_loss:4.4193 train_time:16555ms step_avg:143.96ms
step:126/1480 train_time:16651ms step_avg:143.54ms
step:127/1480 train_time:16799ms step_avg:143.58ms
step:128/1480 train_time:16947ms step_avg:143.62ms
step:129/1480 train_time:17092ms step_avg:143.63ms
step:130/1480 train_time:17238ms step_avg:143.65ms
step:131/1480 train_time:17385ms step_avg:143.68ms
step:132/1480 train_time:17532ms step_avg:143.70ms
step:133/1480 train_time:17680ms step_avg:143.74ms
step:134/1480 train_time:17829ms step_avg:143.78ms
step:135/1480 train_time:17977ms step_avg:143.81ms
step:136/1480 train_time:18125ms step_avg:143.85ms
step:137/1480 train_time:18271ms step_avg:143.86ms
step:138/1480 train_time:18417ms step_avg:143.88ms
step:139/1480 train_time:18565ms step_avg:143.91ms
step:140/1480 train_time:18711ms step_avg:143.93ms
step:141/1480 train_time:18859ms step_avg:143.96ms
step:142/1480 train_time:19007ms step_avg:143.99ms
step:143/1480 train_time:19154ms step_avg:144.01ms
step:144/1480 train_time:19302ms step_avg:144.05ms
step:145/1480 train_time:19450ms step_avg:144.07ms
step:146/1480 train_time:19595ms step_avg:144.08ms
step:147/1480 train_time:19742ms step_avg:144.10ms
step:148/1480 train_time:19889ms step_avg:144.12ms
step:149/1480 train_time:20034ms step_avg:144.13ms
step:150/1480 train_time:20182ms step_avg:144.16ms
step:151/1480 train_time:20330ms step_avg:144.18ms
step:152/1480 train_time:20476ms step_avg:144.20ms
step:153/1480 train_time:20625ms step_avg:144.23ms
step:154/1480 train_time:20771ms step_avg:144.24ms
step:155/1480 train_time:20918ms step_avg:144.26ms
step:156/1480 train_time:21066ms step_avg:144.29ms
step:157/1480 train_time:21211ms step_avg:144.29ms
step:158/1480 train_time:21359ms step_avg:144.32ms
step:159/1480 train_time:21506ms step_avg:144.34ms
step:160/1480 train_time:21653ms step_avg:144.35ms
step:161/1480 train_time:21802ms step_avg:144.38ms
step:162/1480 train_time:21949ms step_avg:144.40ms
step:163/1480 train_time:22096ms step_avg:144.42ms
step:164/1480 train_time:22244ms step_avg:144.44ms
step:165/1480 train_time:22390ms step_avg:144.45ms
step:166/1480 train_time:22537ms step_avg:144.47ms
step:167/1480 train_time:22684ms step_avg:144.48ms
step:168/1480 train_time:22831ms step_avg:144.50ms
step:169/1480 train_time:22978ms step_avg:144.52ms
step:170/1480 train_time:23126ms step_avg:144.54ms
step:171/1480 train_time:23272ms step_avg:144.55ms
step:172/1480 train_time:23418ms step_avg:144.55ms
step:173/1480 train_time:23565ms step_avg:144.57ms
step:174/1480 train_time:23711ms step_avg:144.58ms
step:175/1480 train_time:23859ms step_avg:144.60ms
step:176/1480 train_time:24007ms step_avg:144.62ms
step:177/1480 train_time:24154ms step_avg:144.64ms
step:178/1480 train_time:24303ms step_avg:144.66ms
step:179/1480 train_time:24450ms step_avg:144.67ms
step:180/1480 train_time:24595ms step_avg:144.68ms
step:181/1480 train_time:24744ms step_avg:144.70ms
step:182/1480 train_time:24891ms step_avg:144.71ms
step:183/1480 train_time:25037ms step_avg:144.72ms
step:184/1480 train_time:25185ms step_avg:144.74ms
step:185/1480 train_time:25332ms step_avg:144.75ms
step:186/1480 train_time:25478ms step_avg:144.76ms
step:187/1480 train_time:25625ms step_avg:144.77ms
step:188/1480 train_time:25772ms step_avg:144.79ms
step:189/1480 train_time:25921ms step_avg:144.81ms
step:190/1480 train_time:26069ms step_avg:144.83ms
step:191/1480 train_time:26215ms step_avg:144.83ms
step:192/1480 train_time:26363ms step_avg:144.85ms
step:193/1480 train_time:26509ms step_avg:144.86ms
step:194/1480 train_time:26656ms step_avg:144.87ms
step:195/1480 train_time:26804ms step_avg:144.89ms
step:196/1480 train_time:26951ms step_avg:144.90ms
step:197/1480 train_time:27099ms step_avg:144.91ms
step:198/1480 train_time:27247ms step_avg:144.93ms
step:199/1480 train_time:27392ms step_avg:144.93ms
step:200/1480 train_time:27541ms step_avg:144.95ms
step:201/1480 train_time:27688ms step_avg:144.96ms
step:202/1480 train_time:27835ms step_avg:144.98ms
step:203/1480 train_time:27983ms step_avg:144.99ms
step:204/1480 train_time:28130ms step_avg:145.00ms
step:205/1480 train_time:28276ms step_avg:145.01ms
step:206/1480 train_time:28424ms step_avg:145.02ms
step:207/1480 train_time:28570ms step_avg:145.03ms
step:208/1480 train_time:28718ms step_avg:145.04ms
step:209/1480 train_time:28865ms step_avg:145.05ms
step:210/1480 train_time:29011ms step_avg:145.05ms
step:211/1480 train_time:29158ms step_avg:145.07ms
step:212/1480 train_time:29306ms step_avg:145.08ms
step:213/1480 train_time:29453ms step_avg:145.09ms
step:214/1480 train_time:29600ms step_avg:145.10ms
step:215/1480 train_time:29748ms step_avg:145.11ms
step:216/1480 train_time:29893ms step_avg:145.11ms
step:217/1480 train_time:30040ms step_avg:145.12ms
step:218/1480 train_time:30187ms step_avg:145.13ms
step:219/1480 train_time:30334ms step_avg:145.14ms
step:220/1480 train_time:30481ms step_avg:145.15ms
step:221/1480 train_time:30631ms step_avg:145.17ms
step:222/1480 train_time:30783ms step_avg:145.20ms
step:223/1480 train_time:30934ms step_avg:145.23ms
step:224/1480 train_time:31084ms step_avg:145.25ms
step:225/1480 train_time:31235ms step_avg:145.28ms
step:226/1480 train_time:31385ms step_avg:145.30ms
step:227/1480 train_time:31535ms step_avg:145.32ms
step:228/1480 train_time:31685ms step_avg:145.35ms
step:229/1480 train_time:31838ms step_avg:145.38ms
step:230/1480 train_time:31989ms step_avg:145.40ms
step:231/1480 train_time:32139ms step_avg:145.42ms
step:232/1480 train_time:32289ms step_avg:145.45ms
step:233/1480 train_time:32440ms step_avg:145.47ms
step:234/1480 train_time:32591ms step_avg:145.49ms
step:235/1480 train_time:32742ms step_avg:145.52ms
step:236/1480 train_time:32893ms step_avg:145.54ms
step:237/1480 train_time:33044ms step_avg:145.57ms
step:238/1480 train_time:33194ms step_avg:145.59ms
step:239/1480 train_time:33343ms step_avg:145.60ms
step:240/1480 train_time:33493ms step_avg:145.62ms
step:241/1480 train_time:33644ms step_avg:145.65ms
step:242/1480 train_time:33794ms step_avg:145.66ms
step:243/1480 train_time:33947ms step_avg:145.70ms
step:244/1480 train_time:34098ms step_avg:145.72ms
step:245/1480 train_time:34249ms step_avg:145.74ms
step:246/1480 train_time:34397ms step_avg:145.75ms
step:247/1480 train_time:34549ms step_avg:145.78ms
step:248/1480 train_time:34700ms step_avg:145.80ms
step:249/1480 train_time:34852ms step_avg:145.82ms
step:250/1480 train_time:35003ms step_avg:145.85ms
step:250/1480 val_loss:3.9961 train_time:35063ms step_avg:146.09ms
step:251/1480 train_time:35161ms step_avg:145.90ms
step:252/1480 train_time:35313ms step_avg:145.92ms
step:253/1480 train_time:35464ms step_avg:145.94ms
step:254/1480 train_time:35615ms step_avg:145.96ms
step:255/1480 train_time:35765ms step_avg:145.98ms
step:256/1480 train_time:35915ms step_avg:146.00ms
step:257/1480 train_time:36065ms step_avg:146.01ms
step:258/1480 train_time:36216ms step_avg:146.03ms
step:259/1480 train_time:36368ms step_avg:146.06ms
step:260/1480 train_time:36520ms step_avg:146.08ms
step:261/1480 train_time:36670ms step_avg:146.10ms
step:262/1480 train_time:36821ms step_avg:146.11ms
step:263/1480 train_time:36970ms step_avg:146.13ms
step:264/1480 train_time:37119ms step_avg:146.14ms
step:265/1480 train_time:37271ms step_avg:146.16ms
step:266/1480 train_time:37421ms step_avg:146.18ms
step:267/1480 train_time:37572ms step_avg:146.19ms
step:268/1480 train_time:37722ms step_avg:146.21ms
step:269/1480 train_time:37874ms step_avg:146.23ms
step:270/1480 train_time:38024ms step_avg:146.25ms
step:271/1480 train_time:38175ms step_avg:146.26ms
step:272/1480 train_time:38325ms step_avg:146.28ms
step:273/1480 train_time:38477ms step_avg:146.30ms
step:274/1480 train_time:38625ms step_avg:146.31ms
step:275/1480 train_time:38778ms step_avg:146.33ms
step:276/1480 train_time:38928ms step_avg:146.35ms
step:277/1480 train_time:39079ms step_avg:146.36ms
step:278/1480 train_time:39228ms step_avg:146.37ms
step:279/1480 train_time:39379ms step_avg:146.39ms
step:280/1480 train_time:39530ms step_avg:146.41ms
step:281/1480 train_time:39681ms step_avg:146.42ms
step:282/1480 train_time:39831ms step_avg:146.44ms
step:283/1480 train_time:39982ms step_avg:146.45ms
step:284/1480 train_time:40131ms step_avg:146.46ms
step:285/1480 train_time:40283ms step_avg:146.48ms
step:286/1480 train_time:40434ms step_avg:146.50ms
step:287/1480 train_time:40584ms step_avg:146.51ms
step:288/1480 train_time:40735ms step_avg:146.53ms
step:289/1480 train_time:40885ms step_avg:146.54ms
step:290/1480 train_time:41035ms step_avg:146.55ms
step:291/1480 train_time:41185ms step_avg:146.57ms
step:292/1480 train_time:41336ms step_avg:146.58ms
step:293/1480 train_time:41486ms step_avg:146.59ms
step:294/1480 train_time:41638ms step_avg:146.61ms
step:295/1480 train_time:41788ms step_avg:146.62ms
step:296/1480 train_time:41939ms step_avg:146.64ms
step:297/1480 train_time:42089ms step_avg:146.65ms
step:298/1480 train_time:42241ms step_avg:146.67ms
step:299/1480 train_time:42391ms step_avg:146.68ms
step:300/1480 train_time:42542ms step_avg:146.70ms
step:301/1480 train_time:42692ms step_avg:146.71ms
step:302/1480 train_time:42842ms step_avg:146.72ms
step:303/1480 train_time:42993ms step_avg:146.73ms
step:304/1480 train_time:43143ms step_avg:146.74ms
step:305/1480 train_time:43292ms step_avg:146.75ms
step:306/1480 train_time:43443ms step_avg:146.77ms
step:307/1480 train_time:43595ms step_avg:146.78ms
step:308/1480 train_time:43746ms step_avg:146.80ms
step:309/1480 train_time:43898ms step_avg:146.81ms
step:310/1480 train_time:44047ms step_avg:146.82ms
step:311/1480 train_time:44198ms step_avg:146.84ms
step:312/1480 train_time:44348ms step_avg:146.85ms
step:313/1480 train_time:44499ms step_avg:146.86ms
step:314/1480 train_time:44648ms step_avg:146.87ms
step:315/1480 train_time:44800ms step_avg:146.88ms
step:316/1480 train_time:44951ms step_avg:146.90ms
step:317/1480 train_time:45102ms step_avg:146.91ms
step:318/1480 train_time:45252ms step_avg:146.92ms
step:319/1480 train_time:45402ms step_avg:146.93ms
step:320/1480 train_time:45553ms step_avg:146.95ms
step:321/1480 train_time:45704ms step_avg:146.96ms
step:322/1480 train_time:45855ms step_avg:146.97ms
step:323/1480 train_time:46004ms step_avg:146.98ms
step:324/1480 train_time:46155ms step_avg:146.99ms
step:325/1480 train_time:46305ms step_avg:147.00ms
step:326/1480 train_time:46457ms step_avg:147.02ms
step:327/1480 train_time:46608ms step_avg:147.03ms
step:328/1480 train_time:46759ms step_avg:147.04ms
step:329/1480 train_time:46909ms step_avg:147.05ms
step:330/1480 train_time:47061ms step_avg:147.07ms
step:331/1480 train_time:47214ms step_avg:147.09ms
step:332/1480 train_time:47369ms step_avg:147.11ms
step:333/1480 train_time:47522ms step_avg:147.13ms
step:334/1480 train_time:47676ms step_avg:147.15ms
step:335/1480 train_time:47829ms step_avg:147.17ms
step:336/1480 train_time:47983ms step_avg:147.19ms
step:337/1480 train_time:48138ms step_avg:147.21ms
step:338/1480 train_time:48291ms step_avg:147.23ms
step:339/1480 train_time:48444ms step_avg:147.25ms
step:340/1480 train_time:48598ms step_avg:147.27ms
step:341/1480 train_time:48753ms step_avg:147.29ms
step:342/1480 train_time:48906ms step_avg:147.31ms
step:343/1480 train_time:49061ms step_avg:147.33ms
step:344/1480 train_time:49216ms step_avg:147.35ms
step:345/1480 train_time:49370ms step_avg:147.37ms
step:346/1480 train_time:49524ms step_avg:147.39ms
step:347/1480 train_time:49678ms step_avg:147.41ms
step:348/1480 train_time:49835ms step_avg:147.44ms
step:349/1480 train_time:49989ms step_avg:147.46ms
step:350/1480 train_time:50143ms step_avg:147.48ms
step:351/1480 train_time:50296ms step_avg:147.50ms
step:352/1480 train_time:50450ms step_avg:147.52ms
step:353/1480 train_time:50603ms step_avg:147.53ms
step:354/1480 train_time:50756ms step_avg:147.55ms
step:355/1480 train_time:50910ms step_avg:147.57ms
step:356/1480 train_time:51065ms step_avg:147.59ms
step:357/1480 train_time:51219ms step_avg:147.61ms