homa 0.2.93__tar.gz → 0.2.96__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 (119) hide show
  1. {homa-0.2.93 → homa-0.2.96}/PKG-INFO +1 -1
  2. {homa-0.2.93 → homa-0.2.96}/pyproject.toml +1 -1
  3. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/StoresModels.py +10 -3
  4. homa-0.2.96/src/homa/ensemble/utils.py +9 -0
  5. {homa-0.2.93 → homa-0.2.96}/src/homa.egg-info/PKG-INFO +1 -1
  6. {homa-0.2.93 → homa-0.2.96}/src/homa.egg-info/SOURCES.txt +1 -0
  7. {homa-0.2.93 → homa-0.2.96}/README.md +0 -0
  8. {homa-0.2.93 → homa-0.2.96}/setup.cfg +0 -0
  9. {homa-0.2.93 → homa-0.2.96}/src/homa/__init__.py +0 -0
  10. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/APLU.py +0 -0
  11. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/ActivationFunction.py +0 -0
  12. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/AdaptiveActivationFunction.py +0 -0
  13. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/BaseDLReLU.py +0 -0
  14. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/CaLU.py +0 -0
  15. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/DLReLU.py +0 -0
  16. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/ERF.py +0 -0
  17. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/Elliot.py +0 -0
  18. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/ExpExpish.py +0 -0
  19. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/ExponentialDLReLU.py +0 -0
  20. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/ExponentialSwish.py +0 -0
  21. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/GCU.py +0 -0
  22. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/GaLU.py +0 -0
  23. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/GaussianReLU.py +0 -0
  24. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/GeneralizedSwish.py +0 -0
  25. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/Gish.py +0 -0
  26. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/LaLU.py +0 -0
  27. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/LogLogish.py +0 -0
  28. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/LogSigmoid.py +0 -0
  29. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/Logish.py +0 -0
  30. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/MeLU.py +0 -0
  31. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/MexicanReLU.py +0 -0
  32. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/MinSin.py +0 -0
  33. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/NReLU.py +0 -0
  34. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/NoisyReLU.py +0 -0
  35. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/PLogish.py +0 -0
  36. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/ParametricLogish.py +0 -0
  37. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/Phish.py +0 -0
  38. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/RReLU.py +0 -0
  39. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/RandomizedSlopedReLU.py +0 -0
  40. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/SGELU.py +0 -0
  41. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/SReLU.py +0 -0
  42. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/SelfArctan.py +0 -0
  43. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/ShiftedReLU.py +0 -0
  44. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/SigmoidDerivative.py +0 -0
  45. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/SineReLU.py +0 -0
  46. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/SlopedReLU.py +0 -0
  47. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/SmallGaLU.py +0 -0
  48. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/Smish.py +0 -0
  49. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/SoftsignRReLU.py +0 -0
  50. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/Suish.py +0 -0
  51. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/TBSReLU.py +0 -0
  52. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/TSReLU.py +0 -0
  53. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/TangentBipolarSigmoidReLU.py +0 -0
  54. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/TangentSigmoidReLU.py +0 -0
  55. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/TeLU.py +0 -0
  56. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/TripleStateSwish.py +0 -0
  57. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/WideMeLU.py +0 -0
  58. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/__init__.py +0 -0
  59. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/AOAF.py +0 -0
  60. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/AReLU.py +0 -0
  61. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/DPReLU.py +0 -0
  62. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/DualLine.py +0 -0
  63. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/FReLU.py +0 -0
  64. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/LeLeLU.py +0 -0
  65. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/PERU.py +0 -0
  66. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/PiLU.py +0 -0
  67. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/ShiLU.py +0 -0
  68. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/StarReLU.py +0 -0
  69. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/__init__.py +0 -0
  70. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/concerns/ChannelBased.py +0 -0
  71. {homa-0.2.93 → homa-0.2.96}/src/homa/activations/learnable/concerns/__init__.py +0 -0
  72. {homa-0.2.93 → homa-0.2.96}/src/homa/cli/Commands/Command.py +0 -0
  73. {homa-0.2.93 → homa-0.2.96}/src/homa/cli/Commands/InitCommand.py +0 -0
  74. {homa-0.2.93 → homa-0.2.96}/src/homa/cli/Commands/__init__.py +0 -0
  75. {homa-0.2.93 → homa-0.2.96}/src/homa/cli/HomaCommand.py +0 -0
  76. {homa-0.2.93 → homa-0.2.96}/src/homa/cli/namespaces/CacheNamespace.py +0 -0
  77. {homa-0.2.93 → homa-0.2.96}/src/homa/cli/namespaces/MakeNamespace.py +0 -0
  78. {homa-0.2.93 → homa-0.2.96}/src/homa/cli/namespaces/__init__.py +0 -0
  79. {homa-0.2.93 → homa-0.2.96}/src/homa/device.py +0 -0
  80. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/Ensemble.py +0 -0
  81. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/__init__.py +0 -0
  82. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/CalculatesMetricNecessities.py +0 -0
  83. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/PredictsProbabilities.py +0 -0
  84. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/ReportsClassificationMetrics.py +0 -0
  85. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/ReportsEnsembleAccuracy.py +0 -0
  86. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/ReportsEnsembleF1.py +0 -0
  87. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/ReportsEnsembleKappa.py +0 -0
  88. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/ReportsLogits.py +0 -0
  89. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/ReportsSize.py +0 -0
  90. {homa-0.2.93 → homa-0.2.96}/src/homa/ensemble/concerns/__init__.py +0 -0
  91. {homa-0.2.93 → homa-0.2.96}/src/homa/loss/LogitNormLoss.py +0 -0
  92. {homa-0.2.93 → homa-0.2.96}/src/homa/loss/Loss.py +0 -0
  93. {homa-0.2.93 → homa-0.2.96}/src/homa/loss/__init__.py +0 -0
  94. {homa-0.2.93 → homa-0.2.96}/src/homa/settings.py +0 -0
  95. {homa-0.2.93 → homa-0.2.96}/src/homa/torch/__init__.py +0 -0
  96. {homa-0.2.93 → homa-0.2.96}/src/homa/torch/helpers.py +0 -0
  97. {homa-0.2.93 → homa-0.2.96}/src/homa/utils.py +0 -0
  98. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/Classifier.py +0 -0
  99. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/Model.py +0 -0
  100. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/Resnet.py +0 -0
  101. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/StochasticClassifier.py +0 -0
  102. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/StochasticSwin.py +0 -0
  103. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/Swin.py +0 -0
  104. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/__init__.py +0 -0
  105. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/concerns/HasLabels.py +0 -0
  106. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/concerns/HasLogits.py +0 -0
  107. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/concerns/HasProbabilities.py +0 -0
  108. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/concerns/ReportsAccuracy.py +0 -0
  109. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/concerns/ReportsMetrics.py +0 -0
  110. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/concerns/Trainable.py +0 -0
  111. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/concerns/__init__.py +0 -0
  112. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/modules/ResnetModule.py +0 -0
  113. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/modules/SwinModule.py +0 -0
  114. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/modules/__init__.py +0 -0
  115. {homa-0.2.93 → homa-0.2.96}/src/homa/vision/utils.py +0 -0
  116. {homa-0.2.93 → homa-0.2.96}/src/homa.egg-info/dependency_links.txt +0 -0
  117. {homa-0.2.93 → homa-0.2.96}/src/homa.egg-info/entry_points.txt +0 -0
  118. {homa-0.2.93 → homa-0.2.96}/src/homa.egg-info/requires.txt +0 -0
  119. {homa-0.2.93 → homa-0.2.96}/src/homa.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: homa
3
- Version: 0.2.93
3
+ Version: 0.2.96
4
4
  Summary: A curated list of machine learning and deep learning helpers.
5
5
  Author-email: Taha Shieenavaz <tahashieenavaz@gmail.com>
6
6
  Requires-Python: >=3.7
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "homa"
7
- version = "0.2.93"
7
+ version = "0.2.96"
8
8
  description = "A curated list of machine learning and deep learning helpers."
9
9
  authors = [
10
10
  { name="Taha Shieenavaz", email="tahashieenavaz@gmail.com" },
@@ -1,7 +1,8 @@
1
1
  import torch
2
- from copy import deepcopy
2
+ import io
3
3
  from typing import List
4
4
  from ...vision import Model
5
+ from ..utils import get_model_device
5
6
 
6
7
 
7
8
  class StoresModels:
@@ -12,11 +13,17 @@ class StoresModels:
12
13
  def record(self, model: Model | torch.nn.Module):
13
14
  model_: torch.nn.Module | None = None
14
15
  if isinstance(model, Model):
15
- model_ = deepcopy(model.network)
16
+ model_ = model.network
16
17
  elif isinstance(model, torch.nn.Module):
17
- model_ = deepcopy(model)
18
+ model_ = model
18
19
  else:
19
20
  raise TypeError("Wrong input to ensemble record")
21
+
22
+ device = get_model_device(model_)
23
+ buffer = io.BytesIO()
24
+ torch.save(model_.to("cpu"), buffer)
25
+ buffer.seek(0)
26
+ model_ = torch.load(buffer, map_location=device)
20
27
  self.models.append(model_)
21
28
 
22
29
  def push(self, *args, **kwargs):
@@ -0,0 +1,9 @@
1
+ import torch
2
+
3
+
4
+ def get_model_device(model: torch.nn.Module):
5
+ try:
6
+ device = next(model.parameters()).device
7
+ except StopIteration:
8
+ device = torch.device("cpu")
9
+ return device
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: homa
3
- Version: 0.2.93
3
+ Version: 0.2.96
4
4
  Summary: A curated list of machine learning and deep learning helpers.
5
5
  Author-email: Taha Shieenavaz <tahashieenavaz@gmail.com>
6
6
  Requires-Python: >=3.7
@@ -81,6 +81,7 @@ src/homa/cli/namespaces/MakeNamespace.py
81
81
  src/homa/cli/namespaces/__init__.py
82
82
  src/homa/ensemble/Ensemble.py
83
83
  src/homa/ensemble/__init__.py
84
+ src/homa/ensemble/utils.py
84
85
  src/homa/ensemble/concerns/CalculatesMetricNecessities.py
85
86
  src/homa/ensemble/concerns/PredictsProbabilities.py
86
87
  src/homa/ensemble/concerns/ReportsClassificationMetrics.py
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