nshutils 0.7.0__tar.gz → 0.10.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nshutils
3
- Version: 0.7.0
3
+ Version: 0.10.0
4
4
  Summary:
5
5
  Author: Nima Shoghi
6
6
  Author-email: nimashoghi@gmail.com
@@ -9,10 +9,11 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Provides-Extra: extra
12
13
  Requires-Dist: beartype
13
14
  Requires-Dist: jaxtyping
14
15
  Requires-Dist: numpy
15
- Requires-Dist: pysnooper
16
+ Requires-Dist: pysnooper ; extra == "extra"
16
17
  Requires-Dist: typing-extensions
17
18
  Description-Content-Type: text/markdown
18
19
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "nshutils"
3
- version = "0.7.0"
3
+ version = "0.10.0"
4
4
  description = ""
5
5
  authors = ["Nima Shoghi <nimashoghi@gmail.com>"]
6
6
  readme = "README.md"
@@ -8,10 +8,10 @@ readme = "README.md"
8
8
  [tool.poetry.dependencies]
9
9
  python = "^3.10"
10
10
  numpy = "*"
11
- pysnooper = "*"
12
11
  jaxtyping = "*"
13
12
  typing-extensions = "*"
14
13
  beartype = "*"
14
+ pysnooper = { version = "*", optional = true }
15
15
 
16
16
 
17
17
  [tool.poetry.group.dev.dependencies]
@@ -31,7 +31,9 @@ strictListInference = true
31
31
  strictDictionaryInference = true
32
32
  strictSetInference = true
33
33
  reportPrivateImportUsage = false
34
- ignore = ["./build/"]
35
34
 
36
35
  [tool.ruff.lint]
37
36
  ignore = ["F722", "F821", "E731", "E741"]
37
+
38
+ [tool.poetry.extras]
39
+ extra = ["pysnooper"]
@@ -1,5 +1,7 @@
1
1
  from . import actsave as actsave
2
2
  from . import typecheck as typecheck
3
+ from .actsave import ActLoad as ActLoad
4
+ from .actsave import ActSave as ActSave
3
5
  from .logging import init_python_logging as init_python_logging
4
6
  from .logging import lovely as lovely
5
7
  from .logging import pretty as pretty
@@ -1,6 +1,4 @@
1
- from ._loader import ActivationLoader as ActivationLoader
2
1
  from ._loader import ActLoad as ActLoad
3
2
  from ._saver import Activation as Activation
4
- from ._saver import ActivationSaver as ActivationSaver
5
3
  from ._saver import ActSave as ActSave
6
4
  from ._saver import Transform as Transform
@@ -53,11 +53,11 @@ def _to_numpy(activation: Value) -> np.ndarray:
53
53
  elif isinstance(activation, np.ndarray):
54
54
  return activation
55
55
  elif isinstance(activation, Tensor):
56
- activation = activation.detach()
57
- if activation.is_floating_point():
56
+ activation_ = activation.detach()
57
+ if activation_.is_floating_point():
58
58
  # NOTE: We need to convert to float32 because [b]float16 is not supported by numpy
59
- activation = activation.float()
60
- return activation.cpu().numpy()
59
+ activation_ = activation_.float()
60
+ return activation_.cpu().numpy()
61
61
  else:
62
62
  log.warning(f"Unrecognized activation type {type(activation)}")
63
63
 
@@ -358,4 +358,3 @@ class ActSaveProvider:
358
358
 
359
359
 
360
360
  ActSave = ActSaveProvider()
361
- ActivationSaver = ActSave
File without changes