megatron-core 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of megatron-core might be problematic. Click here for more details.

megatron/core/utils.py ADDED
@@ -0,0 +1,137 @@
1
+ # Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
2
+
3
+ """Utility functions used throughout Megatron core"""
4
+ from functools import reduce
5
+ import operator
6
+
7
+ import torch
8
+
9
+ from megatron.core import parallel_state
10
+
11
+
12
+ def ensure_divisibility(numerator, denominator):
13
+ """Ensure that numerator is divisible by the denominator."""
14
+ assert numerator % denominator == 0, "{} is not divisible by {}".format(
15
+ numerator, denominator
16
+ )
17
+
18
+
19
+ def divide(numerator, denominator):
20
+ """Ensure that numerator is divisible by the denominator and return
21
+ the division value."""
22
+ ensure_divisibility(numerator, denominator)
23
+ return numerator // denominator
24
+
25
+ def get_attr_wrapped_model(model, attr):
26
+ """Get an attribute from a wrapped model"""
27
+ if isinstance(model, list):
28
+ raise RuntimeError("_get_attr_wrapped_model given a list of models")
29
+
30
+ while not hasattr(model, attr):
31
+ if not hasattr(model, "module"):
32
+ raise RuntimeError(f"_get_attr_wrapped_model couldn't find attribute {attr}")
33
+
34
+ model = model.module
35
+ return getattr(model, attr)
36
+
37
+ def get_model_type(model):
38
+ return get_attr_wrapped_model(model, 'model_type')
39
+
40
+
41
+ class GlobalMemoryBuffer:
42
+ """Global buffer to avoid dynamic memory allocations.
43
+ Caller should ensure that buffers of the same name
44
+ are not used concurrently."""
45
+
46
+ def __init__(self):
47
+ self.buffer = {}
48
+
49
+ def get_tensor(self, tensor_shape, dtype, name):
50
+ required_len = reduce(operator.mul, tensor_shape, 1)
51
+ if self.buffer.get((name, dtype), None) is None or \
52
+ self.buffer[(name, dtype)].numel() < required_len:
53
+ self.buffer[(name, dtype)] = \
54
+ torch.empty(required_len,
55
+ dtype=dtype,
56
+ device=torch.cuda.current_device(),
57
+ requires_grad=False)
58
+
59
+ return self.buffer[(name, dtype)][0:required_len].view(*tensor_shape)
60
+
61
+ def _kernel_make_viewless_tensor(inp, requires_grad):
62
+ '''Make a viewless tensor.
63
+
64
+ View tensors have the undesirable side-affect of retaining a reference
65
+ to the originally-viewed tensor, even after manually setting the '.data'
66
+ field. This method creates a new tensor that links to the old tensor's
67
+ data, without linking the viewed tensor, referenced via the '._base'
68
+ field.
69
+ '''
70
+ out = torch.empty(
71
+ (1,),
72
+ dtype = inp.dtype,
73
+ device = inp.device,
74
+ requires_grad = requires_grad,
75
+ )
76
+ out.data = inp.data
77
+ return out
78
+
79
+ class MakeViewlessTensor(torch.autograd.Function):
80
+ '''
81
+ Autograd function to make a viewless tensor.
82
+
83
+ This function should be used in cases where the computation graph needs
84
+ to be propagated, but we only want a viewless tensor (e.g.,
85
+ ParallelTransformer's hidden_states). Call this function by passing
86
+ 'keep_graph = True' to 'make_viewless_tensor()'.
87
+ '''
88
+ @staticmethod
89
+ def forward(ctx, inp, requires_grad):
90
+ return _kernel_make_viewless_tensor(inp, requires_grad)
91
+ @staticmethod
92
+ def backward(ctx, grad_output):
93
+ return grad_output, None
94
+
95
+ def make_viewless_tensor(inp, requires_grad, keep_graph):
96
+ '''
97
+ Entry-point for creating viewless tensors.
98
+
99
+ This method should be used, rather than calling 'MakeViewlessTensor'
100
+ or '_kernel_make_viewless_tensor' directly. This method acts as a
101
+ switch for determining if an autograd function or a regular method
102
+ should be used to create the tensor.
103
+ '''
104
+
105
+ # return tensor as-is, if not a 'view'
106
+ if inp._base is None:
107
+ return inp
108
+
109
+ # create viewless tensor
110
+ if keep_graph:
111
+ return MakeViewlessTensor.apply(inp, requires_grad)
112
+ else:
113
+ return _kernel_make_viewless_tensor(inp, requires_grad)
114
+
115
+ def assert_viewless_tensor(tensor, extra_msg = None):
116
+ '''Assert that a tensor is not a view (i.e., its '._base' field is
117
+ not set).'''
118
+ if isinstance(tensor, list):
119
+ [ assert_viewless_tensor(t) for t in tensor ]
120
+ return tensor
121
+ if not isinstance(tensor, torch.Tensor):
122
+ return tensor
123
+ assert tensor._base is None, (
124
+ "Ensure tensor._base is None before setting tensor.data or storing "
125
+ "tensor to memory buffer. Otherwise, a memory leak will occur (and "
126
+ "likely accumulate over iterations). %s"
127
+ ) % extra_msg
128
+ return tensor
129
+
130
+ def safely_set_viewless_tensor_data(tensor, new_data_tensor):
131
+ '''Safely set tensor's '.data' field.
132
+
133
+ Check first that the tensor is viewless (i.e., '._base' not set). If not,
134
+ raise an exception.
135
+ '''
136
+ assert_viewless_tensor(tensor, extra_msg = "FYI, tensor._base has shape %s, and new_data_tensor has shape %s." % ("--" if tensor._base is None else tensor._base.shape, new_data_tensor.shape))
137
+ tensor.data = new_data_tensor
@@ -0,0 +1,376 @@
1
+ The following applies to all files unless otherwise noted:
2
+
3
+ # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions
7
+ # are met:
8
+ # * Redistributions of source code must retain the above copyright
9
+ # notice, this list of conditions and the following disclaimer.
10
+ # * Redistributions in binary form must reproduce the above copyright
11
+ # notice, this list of conditions and the following disclaimer in the
12
+ # documentation and/or other materials provided with the distribution.
13
+ # * Neither the name of NVIDIA CORPORATION nor the names of its
14
+ # contributors may be used to endorse or promote products derived
15
+ # from this software without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
18
+ # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25
+ # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ --
30
+
31
+ This repository also contains code from Hugging Face Inc., Google Research,
32
+ Facebook (from their Fairseq and Dino projects), Microsoft(from their
33
+ Swin-Transformer project)and Philip Popien. Files from these
34
+ organizations have notices at the top of each file. Below are
35
+ licenses used in those files, as indicated.
36
+
37
+
38
+ ------------- LICENSE FOR Facebook, huggingface and Google Research code --------------
39
+
40
+
41
+ Apache License
42
+ Version 2.0, January 2004
43
+ http://www.apache.org/licenses/
44
+
45
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
46
+
47
+ 1. Definitions.
48
+
49
+ "License" shall mean the terms and conditions for use, reproduction,
50
+ and distribution as defined by Sections 1 through 9 of this document.
51
+
52
+ "Licensor" shall mean the copyright owner or entity authorized by
53
+ the copyright owner that is granting the License.
54
+
55
+ "Legal Entity" shall mean the union of the acting entity and all
56
+ other entities that control, are controlled by, or are under common
57
+ control with that entity. For the purposes of this definition,
58
+ "control" means (i) the power, direct or indirect, to cause the
59
+ direction or management of such entity, whether by contract or
60
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
61
+ outstanding shares, or (iii) beneficial ownership of such entity.
62
+
63
+ "You" (or "Your") shall mean an individual or Legal Entity
64
+ exercising permissions granted by this License.
65
+
66
+ "Source" form shall mean the preferred form for making modifications,
67
+ including but not limited to software source code, documentation
68
+ source, and configuration files.
69
+
70
+ "Object" form shall mean any form resulting from mechanical
71
+ transformation or translation of a Source form, including but
72
+ not limited to compiled object code, generated documentation,
73
+ and conversions to other media types.
74
+
75
+ "Work" shall mean the work of authorship, whether in Source or
76
+ Object form, made available under the License, as indicated by a
77
+ copyright notice that is included in or attached to the work
78
+ (an example is provided in the Appendix below).
79
+
80
+ "Derivative Works" shall mean any work, whether in Source or Object
81
+ form, that is based on (or derived from) the Work and for which the
82
+ editorial revisions, annotations, elaborations, or other modifications
83
+ represent, as a whole, an original work of authorship. For the purposes
84
+ of this License, Derivative Works shall not include works that remain
85
+ separable from, or merely link (or bind by name) to the interfaces of,
86
+ the Work and Derivative Works thereof.
87
+
88
+ "Contribution" shall mean any work of authorship, including
89
+ the original version of the Work and any modifications or additions
90
+ to that Work or Derivative Works thereof, that is intentionally
91
+ submitted to Licensor for inclusion in the Work by the copyright owner
92
+ or by an individual or Legal Entity authorized to submit on behalf of
93
+ the copyright owner. For the purposes of this definition, "submitted"
94
+ means any form of electronic, verbal, or written communication sent
95
+ to the Licensor or its representatives, including but not limited to
96
+ communication on electronic mailing lists, source code control systems,
97
+ and issue tracking systems that are managed by, or on behalf of, the
98
+ Licensor for the purpose of discussing and improving the Work, but
99
+ excluding communication that is conspicuously marked or otherwise
100
+ designated in writing by the copyright owner as "Not a Contribution."
101
+
102
+ "Contributor" shall mean Licensor and any individual or Legal Entity
103
+ on behalf of whom a Contribution has been received by Licensor and
104
+ subsequently incorporated within the Work.
105
+
106
+ 2. Grant of Copyright License. Subject to the terms and conditions of
107
+ this License, each Contributor hereby grants to You a perpetual,
108
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
109
+ copyright license to reproduce, prepare Derivative Works of,
110
+ publicly display, publicly perform, sublicense, and distribute the
111
+ Work and such Derivative Works in Source or Object form.
112
+
113
+ 3. Grant of Patent License. Subject to the terms and conditions of
114
+ this License, each Contributor hereby grants to You a perpetual,
115
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
116
+ (except as stated in this section) patent license to make, have made,
117
+ use, offer to sell, sell, import, and otherwise transfer the Work,
118
+ where such license applies only to those patent claims licensable
119
+ by such Contributor that are necessarily infringed by their
120
+ Contribution(s) alone or by combination of their Contribution(s)
121
+ with the Work to which such Contribution(s) was submitted. If You
122
+ institute patent litigation against any entity (including a
123
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
124
+ or a Contribution incorporated within the Work constitutes direct
125
+ or contributory patent infringement, then any patent licenses
126
+ granted to You under this License for that Work shall terminate
127
+ as of the date such litigation is filed.
128
+
129
+ 4. Redistribution. You may reproduce and distribute copies of the
130
+ Work or Derivative Works thereof in any medium, with or without
131
+ modifications, and in Source or Object form, provided that You
132
+ meet the following conditions:
133
+
134
+ (a) You must give any other recipients of the Work or
135
+ Derivative Works a copy of this License; and
136
+
137
+ (b) You must cause any modified files to carry prominent notices
138
+ stating that You changed the files; and
139
+
140
+ (c) You must retain, in the Source form of any Derivative Works
141
+ that You distribute, all copyright, patent, trademark, and
142
+ attribution notices from the Source form of the Work,
143
+ excluding those notices that do not pertain to any part of
144
+ the Derivative Works; and
145
+
146
+ (d) If the Work includes a "NOTICE" text file as part of its
147
+ distribution, then any Derivative Works that You distribute must
148
+ include a readable copy of the attribution notices contained
149
+ within such NOTICE file, excluding those notices that do not
150
+ pertain to any part of the Derivative Works, in at least one
151
+ of the following places: within a NOTICE text file distributed
152
+ as part of the Derivative Works; within the Source form or
153
+ documentation, if provided along with the Derivative Works; or,
154
+ within a display generated by the Derivative Works, if and
155
+ wherever such third-party notices normally appear. The contents
156
+ of the NOTICE file are for informational purposes only and
157
+ do not modify the License. You may add Your own attribution
158
+ notices within Derivative Works that You distribute, alongside
159
+ or as an addendum to the NOTICE text from the Work, provided
160
+ that such additional attribution notices cannot be construed
161
+ as modifying the License.
162
+
163
+ You may add Your own copyright statement to Your modifications and
164
+ may provide additional or different license terms and conditions
165
+ for use, reproduction, or distribution of Your modifications, or
166
+ for any such Derivative Works as a whole, provided Your use,
167
+ reproduction, and distribution of the Work otherwise complies with
168
+ the conditions stated in this License.
169
+
170
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
171
+ any Contribution intentionally submitted for inclusion in the Work
172
+ by You to the Licensor shall be under the terms and conditions of
173
+ this License, without any additional terms or conditions.
174
+ Notwithstanding the above, nothing herein shall supersede or modify
175
+ the terms of any separate license agreement you may have executed
176
+ with Licensor regarding such Contributions.
177
+
178
+ 6. Trademarks. This License does not grant permission to use the trade
179
+ names, trademarks, service marks, or product names of the Licensor,
180
+ except as required for reasonable and customary use in describing the
181
+ origin of the Work and reproducing the content of the NOTICE file.
182
+
183
+ 7. Disclaimer of Warranty. Unless required by applicable law or
184
+ agreed to in writing, Licensor provides the Work (and each
185
+ Contributor provides its Contributions) on an "AS IS" BASIS,
186
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
187
+ implied, including, without limitation, any warranties or conditions
188
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
189
+ PARTICULAR PURPOSE. You are solely responsible for determining the
190
+ appropriateness of using or redistributing the Work and assume any
191
+ risks associated with Your exercise of permissions under this License.
192
+
193
+ 8. Limitation of Liability. In no event and under no legal theory,
194
+ whether in tort (including negligence), contract, or otherwise,
195
+ unless required by applicable law (such as deliberate and grossly
196
+ negligent acts) or agreed to in writing, shall any Contributor be
197
+ liable to You for damages, including any direct, indirect, special,
198
+ incidental, or consequential damages of any character arising as a
199
+ result of this License or out of the use or inability to use the
200
+ Work (including but not limited to damages for loss of goodwill,
201
+ work stoppage, computer failure or malfunction, or any and all
202
+ other commercial damages or losses), even if such Contributor
203
+ has been advised of the possibility of such damages.
204
+
205
+ 9. Accepting Warranty or Additional Liability. While redistributing
206
+ the Work or Derivative Works thereof, You may choose to offer,
207
+ and charge a fee for, acceptance of support, warranty, indemnity,
208
+ or other liability obligations and/or rights consistent with this
209
+ License. However, in accepting such obligations, You may act only
210
+ on Your own behalf and on Your sole responsibility, not on behalf
211
+ of any other Contributor, and only if You agree to indemnify,
212
+ defend, and hold each Contributor harmless for any liability
213
+ incurred by, or claims asserted against, such Contributor by reason
214
+ of your accepting any such warranty or additional liability.
215
+
216
+ END OF TERMS AND CONDITIONS
217
+
218
+ APPENDIX: How to apply the Apache License to your work.
219
+
220
+ To apply the Apache License to your work, attach the following
221
+ boilerplate notice, with the fields enclosed by brackets "[]"
222
+ replaced with your own identifying information. (Don't include
223
+ the brackets!) The text should be enclosed in the appropriate
224
+ comment syntax for the file format. We also recommend that a
225
+ file or class name and description of purpose be included on the
226
+ same "printed page" as the copyright notice for easier
227
+ identification within third-party archives.
228
+
229
+ Copyright [yyyy] [name of copyright owner]
230
+
231
+ Licensed under the Apache License, Version 2.0 (the "License");
232
+ you may not use this file except in compliance with the License.
233
+ You may obtain a copy of the License at
234
+
235
+ http://www.apache.org/licenses/LICENSE-2.0
236
+
237
+ Unless required by applicable law or agreed to in writing, software
238
+ distributed under the License is distributed on an "AS IS" BASIS,
239
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
240
+ See the License for the specific language governing permissions and
241
+ limitations under the License.
242
+
243
+ ------------- LICENSE FOR Facebook Fairseq code --------------
244
+
245
+ MIT License
246
+
247
+ Copyright (c) Facebook, Inc. and its affiliates.
248
+
249
+ Permission is hereby granted, free of charge, to any person obtaining a copy
250
+ of this software and associated documentation files (the "Software"), to deal
251
+ in the Software without restriction, including without limitation the rights
252
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
253
+ copies of the Software, and to permit persons to whom the Software is
254
+ furnished to do so, subject to the following conditions:
255
+
256
+ The above copyright notice and this permission notice shall be included in all
257
+ copies or substantial portions of the Software.
258
+
259
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
260
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
261
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
262
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
263
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
264
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
265
+ SOFTWARE.
266
+
267
+ ------------- LICENSE FOR Mircrosoft Swin transformer code --------------
268
+
269
+ MIT License
270
+
271
+ Copyright (c) Microsoft Corporation.
272
+
273
+ Permission is hereby granted, free of charge, to any person obtaining a copy
274
+ of this software and associated documentation files (the "Software"), to deal
275
+ in the Software without restriction, including without limitation the rights
276
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
277
+ copies of the Software, and to permit persons to whom the Software is
278
+ furnished to do so, subject to the following conditions:
279
+
280
+ The above copyright notice and this permission notice shall be included in all
281
+ copies or substantial portions of the Software.
282
+
283
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
284
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
285
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
286
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
287
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
288
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
289
+ SOFTWARE
290
+
291
+
292
+ --------------- NVIDIA Source Code License for SegFormer -----------------
293
+ 1. Definitions
294
+
295
+ “Licensor” means any person or entity that distributes its Work.
296
+
297
+ “Software” means the original work of authorship made available under this
298
+ License.
299
+
300
+ “Work” means the Software and any additions to or derivative works of the
301
+ Software that are made available under this License.
302
+
303
+ The terms “reproduce,” “reproduction,” “derivative works,” and
304
+ “distribution” have the meaning as provided under U.S. copyright law;
305
+ provided, however, that for the purposes of this License, derivative works
306
+ shall not include works that remain separable from, or merely link
307
+ (or bind by name) to the interfaces of, the Work.
308
+
309
+ Works, including the Software, are “made available” under this License by
310
+ including in or with the Work either (a) a copyright notice referencing
311
+ the applicability of this License to the Work, or (b) a copy of this License.
312
+
313
+ 2. License Grant
314
+
315
+ 2.1 Copyright Grant. Subject to the terms and conditions of this License,
316
+ each Licensor grants to you a perpetual, worldwide, non-exclusive,
317
+ royalty-free, copyright license to reproduce, prepare derivative works of,
318
+ publicly display, publicly perform, sublicense and distribute its Work
319
+ and any resulting derivative works in any form.
320
+
321
+ 3. Limitations
322
+
323
+ 3.1 Redistribution. You may reproduce or distribute the Work only if
324
+ (a) you do so under this License, (b) you include a complete copy of this
325
+ License with your distribution, and (c) you retain without modification any
326
+ copyright, patent, trademark, or attribution notices that are present
327
+ in the Work.
328
+
329
+ 3.2 Derivative Works. You may specify that additional or different terms
330
+ apply to the use, reproduction, and distribution of your derivative works
331
+ of the Work (“Your Terms”) only if (a) Your Terms provide that the use
332
+ limitation in Section 3.3 applies to your derivative works, and (b) you
333
+ identify the specific derivative works that are subject to Your Terms.
334
+ Notwithstanding Your Terms, this License (including the redistribution
335
+ requirements in Section 3.1) will continue to apply to the Work itself.
336
+
337
+ 3.3 Use Limitation. The Work and any derivative works thereof only may
338
+ be used or intended for use non-commercially. Notwithstanding the
339
+ foregoing, NVIDIA and its affiliates may use the Work and any derivative
340
+ works commercially. As used herein, “non-commercially” means for research
341
+ or evaluation purposes only.
342
+
343
+ 3.4 Patent Claims. If you bring or threaten to bring a patent claim against
344
+ any Licensor (including any claim, cross-claim or counterclaim in a lawsuit)
345
+ to enforce any patents that you allege are infringed by any Work, then
346
+ your rights under this License from such Licensor (including the grant
347
+ in Section 2.1) will terminate immediately.
348
+
349
+ 3.5 Trademarks. This License does not grant any rights to use any Licensor’s
350
+ or its affiliates’ names, logos, or trademarks, except as necessary to
351
+ reproduce the notices described in this License.
352
+
353
+ 3.6 Termination. If you violate any term of this License, then your rights
354
+ under this License (including the grant in Section 2.1) will terminate
355
+ immediately.
356
+
357
+ 4. Disclaimer of Warranty.
358
+
359
+ THE WORK IS PROVIDED “AS IS” WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
360
+ EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
361
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT.
362
+ YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER THIS LICENSE.
363
+
364
+ 5. Limitation of Liability.
365
+
366
+ EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL
367
+ THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE
368
+ SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
369
+ INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
370
+ OF OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK
371
+ (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION,
372
+ LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER
373
+ COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN
374
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
375
+
376
+
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.1
2
+ Name: megatron-core
3
+ Version: 0.1.0
4
+ Summary: Megatron Core - a library for efficient and scalable training of transformer based models
5
+ Home-page: https://github.com/NVIDIA/Megatron-LM/megatron/core
6
+ Download-URL: https://github.com/NVIDIA/Megatron-LM/releases
7
+ Author: NVIDIA
8
+ Author-email: nemo-toolkit@nvidia.com
9
+ Maintainer: NVIDIA
10
+ Maintainer-email: nemo-toolkit@nvidia.com
11
+ License: BSD-3
12
+ Keywords: deep learning,machine learning,gpu,NLP,NLU,language,transformer,nvidia,pytorch,torch
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Intended Audience :: Information Technology
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
19
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Software Development :: Libraries
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Utilities
24
+ Classifier: License :: OSI Approved :: BSD License
25
+ Classifier: Programming Language :: Python :: 3
26
+ Classifier: Programming Language :: Python :: 3.8
27
+ Classifier: Programming Language :: Python :: 3.9
28
+ Classifier: Environment :: Console
29
+ Classifier: Natural Language :: English
30
+ Classifier: Operating System :: OS Independent
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+ Requires-Dist: torch
34
+
35
+ Megatron Core is a library for efficient and scalable training of transformer based models.
@@ -0,0 +1,20 @@
1
+ megatron/core/__init__.py,sha256=UWLkM8uF3EvVESV0rXeMPs_lsm7S_MtqXJcVTHGOHPw,242
2
+ megatron/core/enums.py,sha256=9z8khcaqM4WBqeWrWCxkXqWXh9GQQwpIfc9j8BE2gc8,160
3
+ megatron/core/package_info.py,sha256=dmgbU1sFp6PDipk0RkOCC5JckFYx3nnvpC9peEvJylk,968
4
+ megatron/core/parallel_state.py,sha256=l-Nwt2bC2c0dToFmXryKqXOKAlkfOBC3DP5ZIWa8pb8,23457
5
+ megatron/core/utils.py,sha256=PRX2v_vxTmNPmz0xg_2Ym6xoHpKY_j9_4opgIM53ABA,4834
6
+ megatron/core/pipeline_parallel/__init__.py,sha256=e_qNyIBDy0CW-kzKxLwo1uMkWdCaVXPVy1s0GEH0wb4,49
7
+ megatron/core/pipeline_parallel/p2p_communication.py,sha256=86n_Zuyq7IDuK02NYISMnCG5FBt-s0qt03lonNN1HkQ,17815
8
+ megatron/core/pipeline_parallel/schedules.py,sha256=5LZnLaGwt6U6Cr6OxVr4pe1yjnPNeweRJypLXb75u2I,46863
9
+ megatron/core/tensor_parallel/__init__.py,sha256=hrTGy7cKpqWkkXsu6NNn0bvc2OlcJpZM_sVSlls3MTk,1887
10
+ megatron/core/tensor_parallel/cross_entropy.py,sha256=iQU-VcmKJ_VnFuSONQGYr4lY_3HxHd8Evv5ifg9KAKY,6577
11
+ megatron/core/tensor_parallel/data.py,sha256=OdpJhm6H0LlT8BE6IDGq963-iEJWsHwWWkmTtIEHhiI,3507
12
+ megatron/core/tensor_parallel/layers.py,sha256=_jcLlFKBzYXbt3B04oCeBGm9TO65vhV17fWo9s2TAA0,30234
13
+ megatron/core/tensor_parallel/mappings.py,sha256=34lVtZRht8-RHNZbj6Ihk2tZCdLuaUvg-gtQC-HE1z0,8459
14
+ megatron/core/tensor_parallel/random.py,sha256=6W6LGKJYTpbTbYMl8l2xnfSyCIfENvTPRSE7UaK2sbw,9479
15
+ megatron/core/tensor_parallel/utils.py,sha256=qm9WR8RwS0KyC8HhdMnuzHguP6-CgY_qy1JUq8VfQ9M,4121
16
+ megatron_core-0.1.0.dist-info/LICENSE,sha256=vCw163ggIdEiDLCxB-IWIbu2lS48dfCZclcHQFb3a44,19796
17
+ megatron_core-0.1.0.dist-info/METADATA,sha256=JXAliOHZUFulb78I6u-HHD0oV2pY36jVVw-XcK5S25o,1605
18
+ megatron_core-0.1.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
19
+ megatron_core-0.1.0.dist-info/top_level.txt,sha256=OEOs4V4xHotpQFOUHkfPkLmqcuKfSffSlV17EmZVBjg,9
20
+ megatron_core-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.40.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ megatron