libinephany 0.14.0__tar.gz → 0.14.1__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 (65) hide show
  1. libinephany-0.14.1/CODE_VERSION.cfg +1 -0
  2. {libinephany-0.14.0/libinephany.egg-info → libinephany-0.14.1}/PKG-INFO +1 -1
  3. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/schemas/inner_task_profile.py +3 -0
  4. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/samplers.py +30 -16
  5. {libinephany-0.14.0 → libinephany-0.14.1/libinephany.egg-info}/PKG-INFO +1 -1
  6. libinephany-0.14.0/CODE_VERSION.cfg +0 -1
  7. {libinephany-0.14.0 → libinephany-0.14.1}/LICENSE +0 -0
  8. {libinephany-0.14.0 → libinephany-0.14.1}/MANIFEST.in +0 -0
  9. {libinephany-0.14.0 → libinephany-0.14.1}/README.md +0 -0
  10. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/__init__.py +0 -0
  11. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/aws/__init__.py +0 -0
  12. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/aws/s3_functions.py +0 -0
  13. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/__init__.py +0 -0
  14. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/observation_utils.py +0 -0
  15. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/observer_pipeline.py +0 -0
  16. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/observers/__init__.py +0 -0
  17. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/observers/base_observers.py +0 -0
  18. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/observers/global_observers.py +0 -0
  19. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/observers/local_observers.py +0 -0
  20. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/observers/observer_containers.py +0 -0
  21. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/pipeline_coordinator.py +0 -0
  22. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/post_processors/__init__.py +0 -0
  23. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/post_processors/postprocessors.py +0 -0
  24. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/statistic_manager.py +0 -0
  25. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/observations/statistic_trackers.py +0 -0
  26. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/__init__.py +0 -0
  27. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/configs/__init__.py +0 -0
  28. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/configs/hyperparameter_configs.py +0 -0
  29. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/configs/observer_config.py +0 -0
  30. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/configs/outer_model_config.py +0 -0
  31. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/schemas/__init__.py +0 -0
  32. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/schemas/agent_info.py +0 -0
  33. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/schemas/observation_models.py +0 -0
  34. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/schemas/request_schemas.py +0 -0
  35. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/schemas/response_schemas.py +0 -0
  36. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/schemas/tensor_statistics.py +0 -0
  37. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/states/__init__.py +0 -0
  38. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/pydantic_models/states/hyperparameter_states.py +0 -0
  39. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/__init__.py +0 -0
  40. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/agent_utils.py +0 -0
  41. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/asyncio_worker.py +0 -0
  42. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/backend_statuses.py +0 -0
  43. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/constants.py +0 -0
  44. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/directory_utils.py +0 -0
  45. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/dropout_utils.py +0 -0
  46. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/enums.py +0 -0
  47. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/error_severities.py +0 -0
  48. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/exceptions.py +0 -0
  49. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/import_utils.py +0 -0
  50. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/optim_utils.py +0 -0
  51. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/random_seeds.py +0 -0
  52. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/standardizers.py +0 -0
  53. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/torch_distributed_utils.py +0 -0
  54. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/torch_utils.py +0 -0
  55. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/transforms.py +0 -0
  56. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/utils/typing.py +0 -0
  57. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/web_apps/__init__.py +0 -0
  58. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/web_apps/error_logger.py +0 -0
  59. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany/web_apps/web_app_utils.py +0 -0
  60. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany.egg-info/SOURCES.txt +0 -0
  61. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany.egg-info/dependency_links.txt +0 -0
  62. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany.egg-info/requires.txt +0 -0
  63. {libinephany-0.14.0 → libinephany-0.14.1}/libinephany.egg-info/top_level.txt +0 -0
  64. {libinephany-0.14.0 → libinephany-0.14.1}/pyproject.toml +0 -0
  65. {libinephany-0.14.0 → libinephany-0.14.1}/setup.cfg +0 -0
@@ -0,0 +1 @@
1
+ 0.14.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libinephany
3
- Version: 0.14.0
3
+ Version: 0.14.1
4
4
  Summary: Inephany library containing code commonly used by multiple subpackages.
5
5
  Author-email: Inephany <info@inephany.com>
6
6
  License: Apache 2.0
@@ -24,6 +24,7 @@ class InnerTaskProfile(BaseModel):
24
24
  number_of_layers: int
25
25
  observation_space_sizes: dict[str, int]
26
26
  action_space_sizes: dict[str, int]
27
+ number_of_parameters: int
27
28
  vram_usage: float
28
29
  idle_vram_usage: float
29
30
 
@@ -206,6 +207,7 @@ class InnerTaskProfiles(BaseModel):
206
207
  number_of_layers: int,
207
208
  observation_space_sizes: dict[str, int],
208
209
  action_space_sizes: dict[str, int],
210
+ number_of_parameters: int,
209
211
  vram_usage: float,
210
212
  idle_vram_usage: float,
211
213
  ) -> None:
@@ -226,6 +228,7 @@ class InnerTaskProfiles(BaseModel):
226
228
  number_of_layers=number_of_layers,
227
229
  observation_space_sizes=observation_space_sizes,
228
230
  action_space_sizes=action_space_sizes,
231
+ number_of_parameters=number_of_parameters,
229
232
  vram_usage=vram_usage,
230
233
  idle_vram_usage=idle_vram_usage,
231
234
  )
@@ -6,6 +6,7 @@
6
6
 
7
7
  import math
8
8
  from abc import abstractmethod
9
+ from typing import Any
9
10
 
10
11
  import numpy as np
11
12
 
@@ -20,14 +21,14 @@ from libinephany.utils import random_seeds
20
21
 
21
22
  class Sampler:
22
23
 
23
- def __init__(self, lower_bound: float | int, upper_bound: float | int, **kwargs) -> None:
24
+ def __init__(self, lower_bound: float | int | None, upper_bound: float | int | None, **kwargs) -> None:
24
25
  """
25
26
  :param lower_bound: Lower bound of the distribution to sample from.
26
27
  :param upper_bound: Upper bound of the distribution to sample from.
27
28
  :param kwargs: Miscellaneous keyword arguments.
28
29
  """
29
30
 
30
- if upper_bound < lower_bound:
31
+ if upper_bound is not None and lower_bound is not None and upper_bound < lower_bound:
31
32
  upper_bound, lower_bound = lower_bound, upper_bound
32
33
 
33
34
  self.lower_bound = lower_bound
@@ -37,11 +38,11 @@ class Sampler:
37
38
  self,
38
39
  number_of_samples: int = 1,
39
40
  seed: int | None = None,
40
- ) -> np.ndarray | float:
41
+ ) -> list[Any] | np.ndarray | float:
41
42
  """
42
43
  :param number_of_samples: Number of samples to make.
43
44
  :param seed: Random seed to use for distribution sampling.
44
- :return: Array of sampled values or a single sampled value.
45
+ :return: List/Array of sampled values or a single sampled value.
45
46
  """
46
47
 
47
48
  if seed is not None:
@@ -49,10 +50,16 @@ class Sampler:
49
50
 
50
51
  sample = self.sample(number_of_samples=number_of_samples)
51
52
 
52
- return sample.item() if sample.size == 1 else sample
53
+ if isinstance(sample, np.ndarray) and sample.size == 1:
54
+ return sample.item()
55
+
56
+ elif isinstance(sample, list) and len(sample) == 1:
57
+ return sample[0]
58
+
59
+ return sample
53
60
 
54
61
  @abstractmethod
55
- def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray:
62
+ def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray | list[Any]:
56
63
  """
57
64
  :param number_of_samples: Number of samples to make.
58
65
  :param kwargs: Miscellaneous keyword arguments.
@@ -64,7 +71,7 @@ class Sampler:
64
71
 
65
72
  class LogUniformSampler(Sampler):
66
73
 
67
- def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray:
74
+ def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray | list[Any]:
68
75
  """
69
76
  :param number_of_samples: Number of samples to make.
70
77
  :param kwargs: Miscellaneous keyword arguments.
@@ -78,7 +85,7 @@ class LogUniformSampler(Sampler):
78
85
 
79
86
  class UniformSampler(Sampler):
80
87
 
81
- def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray:
88
+ def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray | list[Any]:
82
89
  """
83
90
  :param number_of_samples: Number of samples to make.
84
91
  :param kwargs: Miscellaneous keyword arguments.
@@ -113,7 +120,7 @@ class DiscreteRangeSampler(Sampler):
113
120
  self.step = step
114
121
  self.sample_dtype = sample_dtype
115
122
 
116
- def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray:
123
+ def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray | list[Any]:
117
124
  """
118
125
  :param number_of_samples: Number of samples to make.
119
126
  :param kwargs: Miscellaneous keyword arguments.
@@ -160,7 +167,7 @@ class RoundRobinSampler(Sampler):
160
167
 
161
168
  return magnitude_list
162
169
 
163
- def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray:
170
+ def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray | list[Any]:
164
171
  """
165
172
  :param number_of_samples: Number of samples to make.
166
173
  :param kwargs: Miscellaneous keyword arguments.
@@ -187,8 +194,8 @@ class DiscreteValueSampler(Sampler):
187
194
 
188
195
  def __init__(
189
196
  self,
190
- discrete_values: list[float | int],
191
- sample_dtype: type[np.generic | float | int] = np.float64,
197
+ discrete_values: list[float | int | str],
198
+ sample_dtype: type[np.generic | float | int | str] = np.float64,
192
199
  **kwargs,
193
200
  ) -> None:
194
201
  """
@@ -196,12 +203,19 @@ class DiscreteValueSampler(Sampler):
196
203
  :param kwargs: Miscellaneous keyword arguments.
197
204
  """
198
205
 
199
- super().__init__(lower_bound=min(discrete_values), upper_bound=max(discrete_values))
206
+ if sample_dtype == str and any(isinstance(value, str) for value in discrete_values):
207
+ lower_bound, upper_bound = None, None
208
+
209
+ else:
210
+ lower_bound = min(discrete_values)
211
+ upper_bound = max(discrete_values)
212
+
213
+ super().__init__(lower_bound=lower_bound, upper_bound=upper_bound) # type: ignore
200
214
 
201
215
  self.discrete_values = discrete_values
202
216
  self.sample_dtype = sample_dtype
203
217
 
204
- def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray:
218
+ def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray | list[Any]:
205
219
  """
206
220
  :param number_of_samples: Number of samples to make.
207
221
  :param kwargs: Miscellaneous keyword arguments.
@@ -234,7 +248,7 @@ class RoundRobinDiscreteValueSampler(Sampler):
234
248
 
235
249
  self.sampled_elements: set[float] = set()
236
250
 
237
- def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray:
251
+ def sample(self, number_of_samples: int = 1, **kwargs) -> np.ndarray | list[Any]:
238
252
  """
239
253
  :param number_of_samples: Number of samples to make.
240
254
  :param kwargs: Miscellaneous keyword arguments.
@@ -329,7 +343,7 @@ def sample_from_discrete_range(
329
343
  return sample
330
344
 
331
345
 
332
- def sample_from_discrete_values(discrete_values: list[float | int], number_of_samples: int = 1) -> np.ndarray:
346
+ def sample_from_discrete_values(discrete_values: list[float | int | str], number_of_samples: int = 1) -> np.ndarray:
333
347
  """
334
348
  :param discrete_values: List of discrete values to sample from.
335
349
  :param number_of_samples: Number of samples to make.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libinephany
3
- Version: 0.14.0
3
+ Version: 0.14.1
4
4
  Summary: Inephany library containing code commonly used by multiple subpackages.
5
5
  Author-email: Inephany <info@inephany.com>
6
6
  License: Apache 2.0
@@ -1 +0,0 @@
1
- 0.14.0
File without changes
File without changes
File without changes
File without changes