homa 0.1.99__tar.gz → 0.2.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 (67) hide show
  1. {homa-0.1.99 → homa-0.2.0}/PKG-INFO +1 -1
  2. {homa-0.1.99 → homa-0.2.0}/pyproject.toml +1 -1
  3. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/classes/__init__.py +0 -1
  4. homa-0.2.0/src/homa/vision/StochasticClassifier.py +28 -0
  5. homa-0.2.0/src/homa/vision/StochasticResnet.py +9 -0
  6. homa-0.2.0/src/homa/vision/StochasticSwin.py +9 -0
  7. {homa-0.1.99 → homa-0.2.0}/src/homa.egg-info/PKG-INFO +1 -1
  8. {homa-0.1.99 → homa-0.2.0}/src/homa.egg-info/SOURCES.txt +1 -2
  9. homa-0.1.99/src/homa/activations/classes/StochasticActivation.py +0 -34
  10. homa-0.1.99/src/homa/vision/StochasticResnet.py +0 -9
  11. homa-0.1.99/src/homa/vision/StochasticSwin.py +0 -9
  12. homa-0.1.99/src/homa/vision/utils.py +0 -25
  13. {homa-0.1.99 → homa-0.2.0}/README.md +0 -0
  14. {homa-0.1.99 → homa-0.2.0}/setup.cfg +0 -0
  15. {homa-0.1.99 → homa-0.2.0}/src/homa/__init__.py +0 -0
  16. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/__init__.py +0 -0
  17. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/classes/APLU.py +0 -0
  18. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/classes/GALU.py +0 -0
  19. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/classes/MELU.py +0 -0
  20. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/classes/PDELU.py +0 -0
  21. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/classes/SReLU.py +0 -0
  22. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/classes/SmallGALU.py +0 -0
  23. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/classes/WideMELU.py +0 -0
  24. {homa-0.1.99 → homa-0.2.0}/src/homa/activations/utils.py +0 -0
  25. {homa-0.1.99 → homa-0.2.0}/src/homa/cli/HomaCommand.py +0 -0
  26. {homa-0.1.99 → homa-0.2.0}/src/homa/cli/namespaces/CacheNamespace.py +0 -0
  27. {homa-0.1.99 → homa-0.2.0}/src/homa/cli/namespaces/MakeNamespace.py +0 -0
  28. {homa-0.1.99 → homa-0.2.0}/src/homa/cli/namespaces/__init__.py +0 -0
  29. {homa-0.1.99 → homa-0.2.0}/src/homa/device.py +0 -0
  30. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/Ensemble.py +0 -0
  31. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/__init__.py +0 -0
  32. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/CalculatesMetricNecessities.py +0 -0
  33. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/PredictsProbabilities.py +0 -0
  34. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/ReportsClassificationMetrics.py +0 -0
  35. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/ReportsEnsembleAccuracy.py +0 -0
  36. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/ReportsEnsembleF1.py +0 -0
  37. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/ReportsEnsembleKappa.py +0 -0
  38. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/ReportsLogits.py +0 -0
  39. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/ReportsSize.py +0 -0
  40. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/StoresModels.py +0 -0
  41. {homa-0.1.99 → homa-0.2.0}/src/homa/ensemble/concerns/__init__.py +0 -0
  42. {homa-0.1.99 → homa-0.2.0}/src/homa/loss/LogitNormLoss.py +0 -0
  43. {homa-0.1.99 → homa-0.2.0}/src/homa/loss/Loss.py +0 -0
  44. {homa-0.1.99 → homa-0.2.0}/src/homa/loss/__init__.py +0 -0
  45. {homa-0.1.99 → homa-0.2.0}/src/homa/settings.py +0 -0
  46. {homa-0.1.99 → homa-0.2.0}/src/homa/torch/__init__.py +0 -0
  47. {homa-0.1.99 → homa-0.2.0}/src/homa/torch/helpers.py +0 -0
  48. {homa-0.1.99 → homa-0.2.0}/src/homa/utils.py +0 -0
  49. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/ClassificationModel.py +0 -0
  50. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/Model.py +0 -0
  51. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/Resnet.py +0 -0
  52. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/Swin.py +0 -0
  53. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/__init__.py +0 -0
  54. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/concerns/HasLabels.py +0 -0
  55. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/concerns/HasLogits.py +0 -0
  56. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/concerns/HasProbabilities.py +0 -0
  57. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/concerns/ReportsAccuracy.py +0 -0
  58. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/concerns/ReportsMetrics.py +0 -0
  59. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/concerns/Trainable.py +0 -0
  60. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/concerns/__init__.py +0 -0
  61. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/modules/ResnetModule.py +0 -0
  62. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/modules/SwinModule.py +0 -0
  63. {homa-0.1.99 → homa-0.2.0}/src/homa/vision/modules/__init__.py +0 -0
  64. {homa-0.1.99 → homa-0.2.0}/src/homa.egg-info/dependency_links.txt +0 -0
  65. {homa-0.1.99 → homa-0.2.0}/src/homa.egg-info/entry_points.txt +0 -0
  66. {homa-0.1.99 → homa-0.2.0}/src/homa.egg-info/requires.txt +0 -0
  67. {homa-0.1.99 → homa-0.2.0}/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.1.99
3
+ Version: 0.2.0
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.1.99"
7
+ version = "0.2.0"
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" },
@@ -5,4 +5,3 @@ from .MELU import MELU
5
5
  from .WideMELU import WideMELU
6
6
  from .PDELU import PDELU
7
7
  from .SReLU import SReLU
8
- from .StochasticActivation import StochasticActivation
@@ -0,0 +1,28 @@
1
+ import torch
2
+ import random
3
+ from ..activations import APLU, GALU, SmallGALU, MELU, WideMELU, PDELU, SReLU
4
+
5
+
6
+ class StochasticClassifier:
7
+ def __init__(self, *args, **kwargs):
8
+ super().__init__(*args, **kwargs)
9
+ self.pool = [
10
+ APLU,
11
+ GALU,
12
+ SmallGALU,
13
+ MELU,
14
+ WideMELU,
15
+ PDELU,
16
+ SReLU,
17
+ torch.nn.ReLU,
18
+ torch.nn.PReLU,
19
+ torch.nn.LeakyReLU,
20
+ torch.nn.ELU,
21
+ ]
22
+
23
+ def replace_activations(self, needle: torch.Tensor) -> None:
24
+ replacement = random.choice(self.pool)
25
+ for parent in self.network.modules():
26
+ for name, child in list(parent.named_children()):
27
+ if isinstance(child, needle):
28
+ setattr(parent, name, replacement())
@@ -0,0 +1,9 @@
1
+ import torch
2
+ from .Resnet import Resnet
3
+ from .StochasticClassifier import StochasticClassifier
4
+
5
+
6
+ class StochasticResnet(Resnet, StochasticClassifier):
7
+ def __init__(self, *args, **kwargs):
8
+ super().__init__(*args, **kwargs)
9
+ self.replace_activations(torch.nn.ReLU)
@@ -0,0 +1,9 @@
1
+ import torch
2
+ from .Swin import Swin
3
+ from .StochasticClassifier import StochasticClassifier
4
+
5
+
6
+ class StochasticSwin(Swin, StochasticClassifier):
7
+ def __init__(self, *args, **kwargs):
8
+ super().__init__(*args, **kwargs)
9
+ self.replace_activations(torch.nn.GELU)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: homa
3
- Version: 0.1.99
3
+ Version: 0.2.0
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
@@ -18,7 +18,6 @@ src/homa/activations/classes/MELU.py
18
18
  src/homa/activations/classes/PDELU.py
19
19
  src/homa/activations/classes/SReLU.py
20
20
  src/homa/activations/classes/SmallGALU.py
21
- src/homa/activations/classes/StochasticActivation.py
22
21
  src/homa/activations/classes/WideMELU.py
23
22
  src/homa/activations/classes/__init__.py
24
23
  src/homa/cli/HomaCommand.py
@@ -45,11 +44,11 @@ src/homa/torch/helpers.py
45
44
  src/homa/vision/ClassificationModel.py
46
45
  src/homa/vision/Model.py
47
46
  src/homa/vision/Resnet.py
47
+ src/homa/vision/StochasticClassifier.py
48
48
  src/homa/vision/StochasticResnet.py
49
49
  src/homa/vision/StochasticSwin.py
50
50
  src/homa/vision/Swin.py
51
51
  src/homa/vision/__init__.py
52
- src/homa/vision/utils.py
53
52
  src/homa/vision/concerns/HasLabels.py
54
53
  src/homa/vision/concerns/HasLogits.py
55
54
  src/homa/vision/concerns/HasProbabilities.py
@@ -1,34 +0,0 @@
1
- import torch
2
- import random
3
-
4
- from .APLU import APLU
5
- from .GALU import GALU
6
- from .SmallGALU import SmallGALU
7
- from .MELU import MELU
8
- from .WideMELU import WideMELU
9
- from .PDELU import PDELU
10
- from .SReLU import SReLU
11
-
12
-
13
- class StochasticActivation(torch.nn.Module):
14
- def __init__(self):
15
- super().__init__()
16
- self.gate = random.choice(
17
- [
18
- APLU,
19
- GALU,
20
- SmallGALU,
21
- MELU,
22
- WideMELU,
23
- PDELU,
24
- SReLU,
25
- torch.nn.ReLU,
26
- torch.nn.PReLU,
27
- torch.nn.LeakyReLU,
28
- torch.nn.ELU,
29
- ]
30
- )
31
- self.gate = self.gate()
32
-
33
- def forward(self, x: torch.Tensor) -> torch.Tensor:
34
- return self.gate(x)
@@ -1,9 +0,0 @@
1
- from .Resnet import Resnet
2
- from .utils import replace_relu
3
- from ..activations import StochasticActivation
4
-
5
-
6
- class StochasticResnet(Resnet):
7
- def __init__(self, *args, **kwargs):
8
- super().__init__(*args, **kwargs)
9
- replace_relu(self.network, StochasticActivation)
@@ -1,9 +0,0 @@
1
- from .Swin import Swin
2
- from .utils import replace_gelu
3
- from ..activations import StochasticActivation
4
-
5
-
6
- class StochasticSwin(Swin):
7
- def __init__(self, *args, **kwargs):
8
- super().__init__(*args, **kwargs)
9
- replace_gelu(self.network.encoder, StochasticActivation)
@@ -1,25 +0,0 @@
1
- import torch
2
-
3
-
4
- def replace_modules(
5
- model: torch.nn.Module, find: list | torch.Tensor, replacement: torch.nn.Module
6
- ) -> int:
7
- if not isinstance(find, list):
8
- find = [find]
9
-
10
- replaced = 0
11
- for parent in model.modules():
12
- for name, child in list(parent.named_children()):
13
- for needle in find:
14
- if isinstance(child, needle):
15
- setattr(parent, name, replacement())
16
- replaced += 1
17
- return replaced
18
-
19
-
20
- def replace_relu(model: torch.nn.Module, replacement: torch.nn.Module):
21
- return replace_modules(model, torch.nn.ReLU, replacement)
22
-
23
-
24
- def replace_gelu(model: torch.nn.Module, replacement: torch.nn.Module):
25
- return replace_modules(model, torch.nn.GELU, replacement)
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