lucid-dl 2.7.8__tar.gz → 2.8.0__tar.gz

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.
Files changed (133) hide show
  1. {lucid_dl-2.7.8/lucid_dl.egg-info → lucid_dl-2.8.0}/PKG-INFO +3 -3
  2. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/README.md +2 -2
  3. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/__init__.py +1 -0
  4. lucid_dl-2.8.0/lucid/nn/modules/rnn.py +97 -0
  5. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/optim/lr_scheduler/_schedulers.py +36 -0
  6. {lucid_dl-2.7.8 → lucid_dl-2.8.0/lucid_dl.egg-info}/PKG-INFO +3 -3
  7. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid_dl.egg-info/SOURCES.txt +1 -0
  8. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/setup.py +1 -1
  9. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/LICENSE +0 -0
  10. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/__init__.py +0 -0
  11. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_backend/__init__.py +0 -0
  12. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_backend/core.py +0 -0
  13. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_backend/metal.py +0 -0
  14. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_func/__init__.py +0 -0
  15. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_func/bfunc.py +0 -0
  16. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_func/gfunc.py +0 -0
  17. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_func/ufunc.py +0 -0
  18. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_tensor/__init__.py +0 -0
  19. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_tensor/tensor.py +0 -0
  20. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_tensor/tensor_ops.py +0 -0
  21. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_util/__init__.py +0 -0
  22. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/_util/func.py +0 -0
  23. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/data/__init__.py +0 -0
  24. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/data/_base.py +0 -0
  25. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/data/_util.py +0 -0
  26. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/datasets/__init__.py +0 -0
  27. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/datasets/_base.py +0 -0
  28. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/datasets/cifar.py +0 -0
  29. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/datasets/mnist.py +0 -0
  30. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/einops/__init__.py +0 -0
  31. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/einops/_func.py +0 -0
  32. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/error.py +0 -0
  33. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/linalg/__init__.py +0 -0
  34. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/linalg/_func.py +0 -0
  35. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/__init__.py +0 -0
  36. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/__init__.py +0 -0
  37. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/alex.py +0 -0
  38. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/coatnet.py +0 -0
  39. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/convnext.py +0 -0
  40. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/crossvit.py +0 -0
  41. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/cspnet.py +0 -0
  42. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/cvt.py +0 -0
  43. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/dense.py +0 -0
  44. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/efficient.py +0 -0
  45. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/efficientformer.py +0 -0
  46. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/inception.py +0 -0
  47. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/inception_next.py +0 -0
  48. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/inception_res.py +0 -0
  49. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/lenet.py +0 -0
  50. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/maxvit.py +0 -0
  51. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/mobile.py +0 -0
  52. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/pvt.py +0 -0
  53. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/resnest.py +0 -0
  54. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/resnet.py +0 -0
  55. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/resnext.py +0 -0
  56. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/senet.py +0 -0
  57. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/sknet.py +0 -0
  58. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/swin.py +0 -0
  59. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/vgg.py +0 -0
  60. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/vit.py +0 -0
  61. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/xception.py +0 -0
  62. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imgclf/zfnet.py +0 -0
  63. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imggen/__init__.py +0 -0
  64. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imggen/ddpm.py +0 -0
  65. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/imggen/vae.py +0 -0
  66. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/__init__.py +0 -0
  67. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/detr.py +0 -0
  68. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/efficientdet.py +0 -0
  69. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/fast_rcnn.py +0 -0
  70. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/faster_rcnn.py +0 -0
  71. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/rcnn.py +0 -0
  72. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/util.py +0 -0
  73. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/yolo/__init__.py +0 -0
  74. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/yolo/yolo_v1.py +0 -0
  75. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/yolo/yolo_v2.py +0 -0
  76. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/yolo/yolo_v3.py +0 -0
  77. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/objdet/yolo/yolo_v4.py +0 -0
  78. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/seq2seq/__init__.py +0 -0
  79. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/seq2seq/transformer.py +0 -0
  80. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/models/util.py +0 -0
  81. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/__init__.py +0 -0
  82. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/__init__.py +0 -0
  83. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_activation.py +0 -0
  84. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_attention.py +0 -0
  85. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_conv.py +0 -0
  86. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_drop.py +0 -0
  87. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_linear.py +0 -0
  88. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_loss.py +0 -0
  89. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_norm.py +0 -0
  90. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_pool.py +0 -0
  91. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_spatial.py +0 -0
  92. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/functional/_util.py +0 -0
  93. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/fused.py +0 -0
  94. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/init/__init__.py +0 -0
  95. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/init/_dist.py +0 -0
  96. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/module.py +0 -0
  97. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/activation.py +0 -0
  98. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/attention.py +0 -0
  99. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/conv.py +0 -0
  100. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/drop.py +0 -0
  101. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/einops.py +0 -0
  102. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/linear.py +0 -0
  103. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/loss.py +0 -0
  104. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/norm.py +0 -0
  105. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/pool.py +0 -0
  106. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/sparse.py +0 -0
  107. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/transformer.py +0 -0
  108. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/modules/vision.py +0 -0
  109. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/parameter.py +0 -0
  110. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/nn/util.py +0 -0
  111. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/optim/__init__.py +0 -0
  112. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/optim/_base.py +0 -0
  113. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/optim/ada.py +0 -0
  114. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/optim/adam.py +0 -0
  115. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/optim/lr_scheduler/__init__.py +0 -0
  116. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/optim/lr_scheduler/_base.py +0 -0
  117. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/optim/prop.py +0 -0
  118. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/optim/sgd.py +0 -0
  119. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/port.py +0 -0
  120. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/random/__init__.py +0 -0
  121. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/random/_func.py +0 -0
  122. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/transforms/__init__.py +0 -0
  123. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/transforms/_base.py +0 -0
  124. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/transforms/image.py +0 -0
  125. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/types.py +0 -0
  126. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/visual/__init__.py +0 -0
  127. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/visual/graph.py +0 -0
  128. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/weights/__init__.py +0 -0
  129. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid/weights/__init__.pyi +0 -0
  130. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid_dl.egg-info/dependency_links.txt +0 -0
  131. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid_dl.egg-info/requires.txt +0 -0
  132. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/lucid_dl.egg-info/top_level.txt +0 -0
  133. {lucid_dl-2.7.8 → lucid_dl-2.8.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lucid-dl
3
- Version: 2.7.8
3
+ Version: 2.8.0
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
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  ![PyPI - Version](https://img.shields.io/pypi/v/lucid-dl?color=red)
4
4
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/lucid-dl.svg)
5
- ![PyPI - Total Downloads](https://img.shields.io/badge/total%20downloads-32.0k-yellow.svg)
5
+ ![PyPI - Total Downloads](https://img.shields.io/badge/total%20downloads-33.2k-yellow.svg)
6
6
  ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/ChanLumerico/lucid.svg)
7
7
  ![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)
8
- ![Lines of Code](https://img.shields.io/badge/lines%20of%20code-26.1k-purple.svg)
8
+ ![Lines of Code](https://img.shields.io/badge/lines%20of%20code-26.4k-purple.svg)
9
9
 
10
10
  **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.
11
11
 
@@ -10,3 +10,4 @@ from .attention import *
10
10
  from .transformer import *
11
11
  from .sparse import *
12
12
  from .einops import *
13
+ from .rnn import *
@@ -0,0 +1,97 @@
1
+ from typing import Literal
2
+
3
+ import lucid
4
+ import lucid.nn as nn
5
+ import lucid.nn.functional as F
6
+
7
+ from lucid._tensor import Tensor
8
+
9
+ from .activation import Tanh, ReLU
10
+
11
+
12
+ __all__ = ["RNNCell"]
13
+
14
+
15
+ def _get_activation(nonlinearity: str) -> type[nn.Module]:
16
+ if nonlinearity == "tanh":
17
+ return Tanh
18
+ elif nonlinearity == "relu":
19
+ return ReLU
20
+ else:
21
+ raise ValueError(
22
+ f"Invalid nonlinearity '{nonlinearity}'. "
23
+ "Supported nonlinearities are 'tanh' and 'relu'."
24
+ )
25
+
26
+
27
+ class RNNCell(nn.Module):
28
+ def __init__(
29
+ self,
30
+ input_size: int,
31
+ hidden_size: int,
32
+ bias: bool = True,
33
+ nonlinearity: Literal["tanh", "relu"] = "tanh",
34
+ ) -> None:
35
+ super().__init__()
36
+ self.input_size = input_size
37
+ self.hidden_size = hidden_size
38
+ self.bias = bias
39
+ self.nonlinearity = _get_activation(nonlinearity)()
40
+
41
+ sqrt_k = 1.0 / (hidden_size**0.5)
42
+ self.weight_ih = nn.Parameter(
43
+ lucid.random.uniform(-sqrt_k, sqrt_k, (self.hidden_size, self.input_size))
44
+ )
45
+ self.weight_hh = nn.Parameter(
46
+ lucid.random.uniform(-sqrt_k, sqrt_k, (self.hidden_size, self.hidden_size))
47
+ )
48
+
49
+ if self.bias:
50
+ self.bias_ih = nn.Parameter(
51
+ lucid.random.uniform(-sqrt_k, sqrt_k, self.hidden_size)
52
+ )
53
+ self.bias_hh = nn.Parameter(
54
+ lucid.random.uniform(-sqrt_k, sqrt_k, self.hidden_size)
55
+ )
56
+ else:
57
+ self.bias_ih = None
58
+ self.bias_hh = None
59
+
60
+ def forward(self, input_: Tensor, hx: Tensor | None = None) -> Tensor:
61
+ if input_.ndim not in (1, 2):
62
+ raise ValueError(
63
+ "RNNCell expected input with 1 or 2 dimensions, "
64
+ f"got {input_.ndim} dimensions"
65
+ )
66
+
67
+ is_batched = input_.ndim == 2
68
+ if not is_batched:
69
+ input_ = input_.unsqueeze(axis=0)
70
+ batch_size = input_.shape[0]
71
+
72
+ if hx is None:
73
+ hx = lucid.zeros(
74
+ batch_size, self.hidden_size, dtype=input_.dtype, device=input_.device
75
+ )
76
+ else:
77
+ if hx.ndim not in (1, 2):
78
+ raise ValueError(
79
+ "RNNCell expected hidden state with 1 or 2 dimensions, "
80
+ f"got {hx.ndim} dimensions"
81
+ )
82
+ if hx.ndim == 1:
83
+ hx = hx.unsqueeze(axis=0)
84
+
85
+ if hx.shape[0] != batch_size or hx.shape[1] != self.hidden_size:
86
+ raise ValueError(
87
+ "RNNCell expected hidden state with shape "
88
+ f"({batch_size}, {self.hidden_size}), got {hx.shape}"
89
+ )
90
+
91
+ hy = F.linear(input_, self.weight_ih, self.bias_ih)
92
+ hy += F.linear(hx, self.weight_hh, self.bias_hh)
93
+ ret = self.nonlinearity(hy)
94
+
95
+ if not is_batched:
96
+ ret = ret.squeeze(axis=0)
97
+ return ret
@@ -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,38 @@ 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
+ # Noam's schedule computes the absolute learning rate, so we ignore
302
+ # the optimizer's initial lr (base_lr) when returning the new values.
303
+ return [lr_factor for _ 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.8.0
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
 
@@ -102,6 +102,7 @@ lucid/nn/modules/linear.py
102
102
  lucid/nn/modules/loss.py
103
103
  lucid/nn/modules/norm.py
104
104
  lucid/nn/modules/pool.py
105
+ lucid/nn/modules/rnn.py
105
106
  lucid/nn/modules/sparse.py
106
107
  lucid/nn/modules/transformer.py
107
108
  lucid/nn/modules/vision.py
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="lucid-dl",
8
- version="2.7.8",
8
+ version="2.8.0",
9
9
  author="ChanLumerico",
10
10
  author_email="greensox284@gmail.com",
11
11
  description="Lumerico's Comprehensive Interface for Deep Learning",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes