lucid-dl 2.7.8__py3-none-any.whl → 2.7.9__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.
@@ -13,6 +13,7 @@ __all__ = [
13
13
  "CosineAnnealingLR",
14
14
  "ReduceLROnPlateau",
15
15
  "CyclicLR",
16
+ "NoamScheduler",
16
17
  ]
17
18
 
18
19
 
@@ -265,3 +266,36 @@ class CyclicLR(LRScheduler):
265
266
  for _ in self.base_lrs
266
267
  ]
267
268
  return new_lrs
269
+
270
+
271
+ class NoamScheduler(LRScheduler):
272
+ def __init__(
273
+ self,
274
+ optimizer: Optimizer,
275
+ model_size: int,
276
+ warmup_steps: int,
277
+ factor: float = 1.0,
278
+ last_epoch: int = -1,
279
+ verbose: bool = False,
280
+ ) -> None:
281
+ if model_size <= 0:
282
+ raise ValueError("model_size must be a positive integer.")
283
+ if warmup_steps <= 0:
284
+ raise ValueError("warmup_steps must be a positive integer.")
285
+ if factor <= 0:
286
+ raise ValueError("factor must be a positive float.")
287
+
288
+ self.model_size = model_size
289
+ self.warmup_steps = warmup_steps
290
+ self.factor = factor
291
+ super().__init__(optimizer, last_epoch, verbose)
292
+
293
+ def get_lr(self) -> list[float]:
294
+ step_num = max(self.last_epoch, 1)
295
+ scale = self.factor * (self.model_size**-0.5)
296
+
297
+ warmup_term = step_num * (self.warmup_steps**-1.5)
298
+ decay_term = step_num**-0.5
299
+ lr_factor = scale * min(decay_term, warmup_term)
300
+
301
+ return [base_lr * lr_factor for base_lr in self.base_lrs]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lucid-dl
3
- Version: 2.7.8
3
+ Version: 2.7.9
4
4
  Summary: Lumerico's Comprehensive Interface for Deep Learning
5
5
  Home-page: https://github.com/ChanLumerico/lucid
6
6
  Author: ChanLumerico
@@ -30,10 +30,10 @@ Dynamic: summary
30
30
 
31
31
  ![PyPI - Version](https://img.shields.io/pypi/v/lucid-dl?color=red)
32
32
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/lucid-dl.svg)
33
- ![PyPI - Total Downloads](https://img.shields.io/badge/total%20downloads-32.0k-yellow.svg)
33
+ ![PyPI - Total Downloads](https://img.shields.io/badge/total%20downloads-33.2k-yellow.svg)
34
34
  ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/ChanLumerico/lucid.svg)
35
35
  ![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)
36
- ![Lines of Code](https://img.shields.io/badge/lines%20of%20code-26.1k-purple.svg)
36
+ ![Lines of Code](https://img.shields.io/badge/lines%20of%20code-26.4k-purple.svg)
37
37
 
38
38
  **Lucid** is a minimalist deep learning framework built entirely from scratch in Python. It offers a pedagogically rich environment to explore the foundations of modern deep learning systems, including autodiff, neural network modules, and GPU acceleration — all while staying lightweight, readable, and free of complex dependencies.
39
39
 
@@ -110,7 +110,7 @@ lucid/optim/prop.py,sha256=CbsWmoBb_g_8z16M3T6dMoSR9c72hm8M375IT1UHjpw,4740
110
110
  lucid/optim/sgd.py,sha256=DBZ1ZXQ9TfKZCRECfNRMDH9mvqUWCOPdY5TobnVxpz8,4477
111
111
  lucid/optim/lr_scheduler/__init__.py,sha256=kUoyN2g9nwTtEAqEVij832WSRvzEpKZywSJdfD7MQvY,58
112
112
  lucid/optim/lr_scheduler/_base.py,sha256=NNJnjwmJpsRXathrbLtH4tjfBHtwOiJ5HwF1_S6Ym5c,3092
113
- lucid/optim/lr_scheduler/_schedulers.py,sha256=OIzduTXV6Ut4qcvw6neMPr3jlv6BgTSsys0-6KoHxK4,8140
113
+ lucid/optim/lr_scheduler/_schedulers.py,sha256=wxG6XvlTozz2TP57yXQL-krtSiO0hy2bySZq_sRDjh0,9227
114
114
  lucid/random/__init__.py,sha256=s8EAaKhEiTKT_vYjP4IFHx0xQVa1jqc_qIyvMauUu7M,2727
115
115
  lucid/random/_func.py,sha256=1Lu4m-ciEK037chNDGqv_j00RgGGzQ7UfslSfYActUk,2232
116
116
  lucid/transforms/__init__.py,sha256=DGznMbqhXdU9FLDMKnJawScO4HCqu40Sf_j4vJGJrjc,90
@@ -120,8 +120,8 @@ lucid/visual/__init__.py,sha256=6TuFDfmXTwpLyHl7_KqBfdzW6zqHjGzIFvymjFPlvjI,21
120
120
  lucid/visual/graph.py,sha256=YjpIDM_lloZARw3sCBiXPl_hT5A2gTk2fEHvwvJWXTk,4599
121
121
  lucid/weights/__init__.py,sha256=z1AikA3rOEeckWGkYWlcZkxNlJo9Xwa39PL6ly3hWnc,8801
122
122
  lucid/weights/__init__.pyi,sha256=lFonYC3cUx2Idolf3AEPnjFcyqcn3UDU84oJlZafqLY,3013
123
- lucid_dl-2.7.8.dist-info/licenses/LICENSE,sha256=vxRFYnVD1IeYtsvw-KmoElfqrjxKHv1h9YTvsG54loQ,1065
124
- lucid_dl-2.7.8.dist-info/METADATA,sha256=t8DZ8085SXcg8SH2ibdQH5K9zq2toJ3B4qwm-SpLkAk,11519
125
- lucid_dl-2.7.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
- lucid_dl-2.7.8.dist-info/top_level.txt,sha256=uzP_qBx9iNWIHKJRlElYcBLYVqMpdm9Q1Ma63QPYbFc,6
127
- lucid_dl-2.7.8.dist-info/RECORD,,
123
+ lucid_dl-2.7.9.dist-info/licenses/LICENSE,sha256=vxRFYnVD1IeYtsvw-KmoElfqrjxKHv1h9YTvsG54loQ,1065
124
+ lucid_dl-2.7.9.dist-info/METADATA,sha256=-h9IwL5SzshStMIt4eYUB0rWJ7nTELdGWSD9FIIWM00,11519
125
+ lucid_dl-2.7.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
+ lucid_dl-2.7.9.dist-info/top_level.txt,sha256=uzP_qBx9iNWIHKJRlElYcBLYVqMpdm9Q1Ma63QPYbFc,6
127
+ lucid_dl-2.7.9.dist-info/RECORD,,