kacperwikiel commited on
Commit
e2562df
·
verified ·
1 Parent(s): aaa3496

Back up runs/cosmopedia-1337/checkpoint-000001000

Browse files
runs/cosmopedia-1337/checkpoint-000001000/LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
runs/cosmopedia-1337/checkpoint-000001000/NOTICE ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GoLLeM-149M-20B
2
+
3
+ Weights and architecture derive from SlayerLab/gollem-v5-ckpts
4
+ revision 963440ce6ab4ada7e95da4c1faa28ebb00c082d4, published under Apache-2.0.
5
+ modeling_gollem.py extracts the inference classes unchanged from the pinned
6
+ GoLLeM r6 training implementation. The continuation, export and release scripts
7
+ were prepared for this 149M run.
8
+
9
+ The likelihood routines in glint_metrics.py are adapted from
10
+ Glint-Research/Glint-1.3/benchmark.py, revision
11
+ c3f99e246aa2c64382f9668dc864533617482d0a, whose repository declares MIT.
12
+ Copyright remains with the original contributors. MIT license text:
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in
22
+ all copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30
+ THE SOFTWARE.
runs/cosmopedia-1337/checkpoint-000001000/config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "vocab": 12288,
3
+ "n_layer": 19,
4
+ "n_embd": 768,
5
+ "n_head": 12,
6
+ "block": 1024,
7
+ "ffn_mult": 2.8125,
8
+ "norm": "rmsnorm",
9
+ "norm_eps": 1e-06,
10
+ "pos": "rope",
11
+ "rope_theta": 100000.0,
12
+ "ffn": "swiglu",
13
+ "value_residual": true,
14
+ "qk_norm": true,
15
+ "logit_cap": 0.0,
16
+ "z_loss": 0.0
17
+ }
runs/cosmopedia-1337/checkpoint-000001000/generate.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Simple causal completion CLI (no KV cache)."""
2
+ import argparse
3
+ from contextlib import nullcontext
4
+ import torch
5
+ from load_model import load_model
6
+
7
+ def main():
8
+ p=argparse.ArgumentParser()
9
+ p.add_argument('--model-dir',default='.')
10
+ p.add_argument('--prompt',default='The scientific method is')
11
+ p.add_argument('--max-new-tokens',type=int,default=64)
12
+ p.add_argument('--temperature',type=float,default=0.0)
13
+ p.add_argument('--device',default='cuda' if torch.cuda.is_available() else 'cpu')
14
+ args=p.parse_args();torch.set_num_threads(4)
15
+ model,tok=load_model(args.model_dir,args.device)
16
+ ids=tok.encode(args.prompt).ids
17
+ if not ids:raise ValueError('Prompt must encode to at least one token')
18
+ eos=tok.token_to_id('<|endoftext|>')
19
+ with torch.inference_mode():
20
+ for _ in range(args.max_new_tokens):
21
+ x=torch.tensor([ids[-model.block:]],device=args.device)
22
+ ctx=torch.autocast('cuda',dtype=torch.bfloat16) if args.device.startswith('cuda') else nullcontext()
23
+ with ctx:logits=model(x)[0][0,-1].float()
24
+ nxt=int(logits.argmax()) if args.temperature<=0 else int(torch.multinomial(torch.softmax(logits/args.temperature,dim=-1),1))
25
+ ids.append(nxt)
26
+ if nxt==eos:break
27
+ print(tok.decode(ids,skip_special_tokens=True))
28
+ if __name__=='__main__':main()
runs/cosmopedia-1337/checkpoint-000001000/load_model.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Load the local safetensors release without Transformers remote code."""
2
+ import json
3
+ from pathlib import Path
4
+ from types import SimpleNamespace
5
+ import torch
6
+ from safetensors.torch import load_model as load_safetensors
7
+ from tokenizers import Tokenizer
8
+ from modeling_gollem import GPT
9
+
10
+ def load_model(directory='.',device='cpu'):
11
+ directory=Path(directory)
12
+ cfg=SimpleNamespace(**json.loads((directory/'config.json').read_text()))
13
+ model=GPT(cfg.vocab,cfg.n_layer,cfg.n_embd,cfg.n_head,cfg.block,cfg)
14
+ load_safetensors(model,str(directory/'model.safetensors'),strict=True)
15
+ return model.eval().to(device),Tokenizer.from_file(str(directory/'tokenizer.json'))
runs/cosmopedia-1337/checkpoint-000001000/manifest.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "checkpoint_sha256": "6d2a2c83fccd6bc54d3d71ebc3dbd625a05eb554f0aafc0404ebda1e1f8186ee",
3
+ "bytes": 1229596232,
4
+ "path_in_repo": "runs/cosmopedia-1337/checkpoint-000001000/training-state.pt",
5
+ "status": "experimental_checkpoint"
6
+ }
runs/cosmopedia-1337/checkpoint-000001000/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2bb7953eb029496edfe401e0f8a407ad3ed0cdf98e129cc5f74ebd14b6da155
3
+ size 595664096
runs/cosmopedia-1337/checkpoint-000001000/modeling_gollem.py ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """GoLLeM inference architecture, extracted unchanged from the pinned r6 trainer.
2
+ Source: SlayerLab/gollem-v5-ckpts; Apache-2.0. See README and NOTICE.
3
+ """
4
+ import torch
5
+ from torch import nn
6
+ from torch.nn import functional as F
7
+
8
+ class RMSNorm(nn.Module):
9
+ """Qwen3-style RMSNorm (fp32-compute dla stabilnosci). 1D weight -> AdamW w split-Muon."""
10
+ def __init__(self, d, eps=1e-6):
11
+ super().__init__()
12
+ self.weight = nn.Parameter(torch.ones(d))
13
+ self.eps = eps
14
+
15
+ def forward(self, x):
16
+ return x * torch.rsqrt(x.float().pow(2).mean(-1, keepdim=True) + self.eps).to(x.dtype) * self.weight
17
+
18
+
19
+ def make_norm(d, cfg):
20
+ return RMSNorm(d, cfg.norm_eps) if cfg.norm == "rmsnorm" else nn.LayerNorm(d)
21
+
22
+
23
+ def apply_rope(x, base=100000.0):
24
+ """Parameter-free RoPE na [B,H,T,D] (interleaved-conv, port z qwen_model.py). Train==eval
25
+ MUSZA uzywac tej samej konwencji (self-contained eval -> spojne)."""
26
+ _, _, T, dim = x.shape
27
+ pos = torch.arange(T, device=x.device, dtype=torch.float32)
28
+ freq = 1.0 / (base ** (torch.arange(0, dim, 2, device=x.device, dtype=torch.float32) / dim))
29
+ ang = torch.outer(pos, freq)
30
+ cos, sin = ang.cos().to(x.dtype)[None, None], ang.sin().to(x.dtype)[None, None]
31
+ even, odd = x[..., ::2], x[..., 1::2]
32
+ return torch.stack((even * cos - odd * sin, even * sin + odd * cos), dim=-1).flatten(-2)
33
+
34
+
35
+ class SwiGLU(nn.Module):
36
+ """Qwen3 gated-MLP: down(silu(gate(x))*up(x)). 3x 2D bez-bias -> wszystkie do Muon."""
37
+ def __init__(self, d, hidden):
38
+ super().__init__()
39
+ self.gate = nn.Linear(d, hidden, bias=False)
40
+ self.up = nn.Linear(d, hidden, bias=False)
41
+ self.down = nn.Linear(hidden, d, bias=False)
42
+
43
+ def forward(self, x):
44
+ return self.down(F.silu(self.gate(x)) * self.up(x))
45
+
46
+
47
+ class Block(nn.Module):
48
+ def __init__(self, d, nh, block, cfg, is_first=False):
49
+ super().__init__()
50
+ self.ln1 = make_norm(d, cfg)
51
+ self.ln2 = make_norm(d, cfg)
52
+ self.qkv = nn.Linear(d, 3 * d)
53
+ self.proj = nn.Linear(d, d)
54
+ if cfg.ffn == "swiglu":
55
+ self.mlp = SwiGLU(d, int(round(cfg.ffn_mult * d)))
56
+ else:
57
+ self.mlp = nn.Sequential(nn.Linear(d, 4 * d), nn.GELU(), nn.Linear(4 * d, d))
58
+ self.nh = nh
59
+ self.d = d
60
+ self.cfg = cfg
61
+ self.is_first = is_first
62
+ if cfg.value_residual and not is_first:
63
+ self.vr_lambda = nn.Parameter(torch.zeros(1))
64
+ if cfg.qk_norm:
65
+ hd = d // nh
66
+ self.q_norm = RMSNorm(hd, cfg.norm_eps)
67
+ self.k_norm = RMSNorm(hd, cfg.norm_eps)
68
+
69
+ def forward(self, x, v0=None):
70
+ B, T, D = x.size()
71
+ h = self.ln1(x)
72
+ q, k, v = self.qkv(h).split(self.d, dim=2)
73
+ hd = D // self.nh
74
+ q = q.view(B, T, self.nh, hd).transpose(1, 2)
75
+ k = k.view(B, T, self.nh, hd).transpose(1, 2)
76
+ v = v.view(B, T, self.nh, hd).transpose(1, 2)
77
+ if self.cfg.qk_norm:
78
+ q = self.q_norm(q)
79
+ k = self.k_norm(k)
80
+ if self.cfg.pos == "rope":
81
+ q = apply_rope(q, self.cfg.rope_theta)
82
+ k = apply_rope(k, self.cfg.rope_theta)
83
+ if self.cfg.value_residual:
84
+ if self.is_first:
85
+ v0 = v
86
+ else:
87
+ v = v + self.vr_lambda * v0
88
+ y = F.scaled_dot_product_attention(q, k, v, is_causal=True)
89
+ y = y.transpose(1, 2).contiguous().view(B, T, D)
90
+ x = x + self.proj(y)
91
+ x = x + self.mlp(self.ln2(x))
92
+ return x, v0
93
+
94
+
95
+ class GPT(nn.Module):
96
+ def __init__(self, vocab, n_layer, n_embd, n_head, block, cfg):
97
+ super().__init__()
98
+ self.cfg = cfg
99
+ self.tok = nn.Embedding(vocab, n_embd)
100
+ self.use_rope = cfg.pos == "rope"
101
+ if not self.use_rope:
102
+ self.pos = nn.Embedding(block, n_embd)
103
+ self.blocks = nn.ModuleList([Block(n_embd, n_head, block, cfg, is_first=(i == 0)) for i in range(n_layer)])
104
+ self.lnf = make_norm(n_embd, cfg)
105
+ self.head = nn.Linear(n_embd, vocab, bias=False)
106
+ self.head.weight = self.tok.weight # tie
107
+ self.block = block
108
+ self.apply(self._init)
109
+
110
+ def _init(self, m):
111
+ if isinstance(m, nn.Linear):
112
+ nn.init.normal_(m.weight, 0.0, 0.02)
113
+ if m.bias is not None:
114
+ nn.init.zeros_(m.bias)
115
+ elif isinstance(m, nn.Embedding):
116
+ nn.init.normal_(m.weight, 0.0, 0.02)
117
+
118
+ def forward(self, idx, targets=None):
119
+ B, T = idx.size()
120
+ x = self.tok(idx)
121
+ if not self.use_rope:
122
+ pos = torch.arange(T, device=idx.device)
123
+ x = x + self.pos(pos)[None]
124
+ v0 = None
125
+ for b in self.blocks:
126
+ x, v0 = b(x, v0)
127
+ logits = self.head(self.lnf(x))
128
+ cap = getattr(self.cfg, "logit_cap", 0.0)
129
+ if cap and cap > 0:
130
+ logits = cap * torch.tanh(logits / cap)
131
+ loss = None
132
+ if targets is not None:
133
+ flat = logits.view(-1, logits.size(-1))
134
+ loss = F.cross_entropy(flat, targets.view(-1))
135
+ zc = getattr(self.cfg, "z_loss", 0.0)
136
+ if zc and zc > 0:
137
+ lse = torch.logsumexp(flat, dim=-1)
138
+ loss = loss + zc * (lse * lse).mean()
139
+ return logits, loss
140
+
runs/cosmopedia-1337/checkpoint-000001000/requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ torch==2.11.0
2
+ tokenizers==0.22.2
3
+ safetensors==0.6.2
4
+ huggingface-hub==0.36.0
5
+ numpy>=1.26,<3
6
+ pyarrow>=20,<25
runs/cosmopedia-1337/checkpoint-000001000/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
runs/cosmopedia-1337/checkpoint-000001000/training-state.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d2a2c83fccd6bc54d3d71ebc3dbd625a05eb554f0aafc0404ebda1e1f8186ee
3
+ size 1229596232