libinephany 0.13.3__tar.gz → 0.13.5__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. libinephany-0.13.5/CODE_VERSION.cfg +1 -0
  2. {libinephany-0.13.3 → libinephany-0.13.5}/MANIFEST.in +1 -1
  3. {libinephany-0.13.3/libinephany.egg-info → libinephany-0.13.5}/PKG-INFO +25 -34
  4. {libinephany-0.13.3 → libinephany-0.13.5}/README.md +11 -28
  5. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/observers/global_observers.py +2 -1
  6. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/statistic_manager.py +8 -0
  7. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/statistic_trackers.py +8 -0
  8. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/configs/hyperparameter_configs.py +22 -0
  9. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/states/hyperparameter_states.py +21 -5
  10. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/constants.py +1 -0
  11. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/enums.py +2 -0
  12. {libinephany-0.13.3 → libinephany-0.13.5/libinephany.egg-info}/PKG-INFO +25 -34
  13. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany.egg-info/SOURCES.txt +0 -2
  14. {libinephany-0.13.3 → libinephany-0.13.5}/pyproject.toml +17 -4
  15. libinephany-0.13.3/CODE_VERSION.cfg +0 -1
  16. libinephany-0.13.3/requirements.txt +0 -16
  17. libinephany-0.13.3/setup.py +0 -61
  18. {libinephany-0.13.3 → libinephany-0.13.5}/LICENSE +0 -0
  19. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/__init__.py +0 -0
  20. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/aws/__init__.py +0 -0
  21. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/aws/s3_functions.py +0 -0
  22. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/__init__.py +0 -0
  23. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/observation_utils.py +0 -0
  24. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/observer_pipeline.py +0 -0
  25. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/observers/__init__.py +0 -0
  26. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/observers/base_observers.py +0 -0
  27. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/observers/local_observers.py +0 -0
  28. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/observers/observer_containers.py +0 -0
  29. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/pipeline_coordinator.py +0 -0
  30. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/post_processors/__init__.py +0 -0
  31. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/observations/post_processors/postprocessors.py +0 -0
  32. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/__init__.py +0 -0
  33. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/configs/__init__.py +0 -0
  34. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/configs/observer_config.py +0 -0
  35. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/configs/outer_model_config.py +0 -0
  36. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/schemas/__init__.py +0 -0
  37. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/schemas/agent_info.py +0 -0
  38. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/schemas/inner_task_profile.py +0 -0
  39. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/schemas/observation_models.py +0 -0
  40. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/schemas/request_schemas.py +0 -0
  41. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/schemas/response_schemas.py +0 -0
  42. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/schemas/tensor_statistics.py +0 -0
  43. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/pydantic_models/states/__init__.py +0 -0
  44. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/__init__.py +0 -0
  45. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/agent_utils.py +0 -0
  46. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/asyncio_worker.py +0 -0
  47. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/backend_statuses.py +0 -0
  48. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/directory_utils.py +0 -0
  49. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/dropout_utils.py +0 -0
  50. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/error_severities.py +0 -0
  51. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/exceptions.py +0 -0
  52. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/import_utils.py +0 -0
  53. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/optim_utils.py +0 -0
  54. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/random_seeds.py +0 -0
  55. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/samplers.py +0 -0
  56. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/standardizers.py +0 -0
  57. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/torch_distributed_utils.py +0 -0
  58. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/torch_utils.py +0 -0
  59. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/transforms.py +0 -0
  60. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/utils/typing.py +0 -0
  61. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/web_apps/__init__.py +0 -0
  62. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/web_apps/error_logger.py +0 -0
  63. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany/web_apps/web_app_utils.py +0 -0
  64. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany.egg-info/dependency_links.txt +0 -0
  65. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany.egg-info/requires.txt +3 -3
  66. {libinephany-0.13.3 → libinephany-0.13.5}/libinephany.egg-info/top_level.txt +0 -0
  67. {libinephany-0.13.3 → libinephany-0.13.5}/setup.cfg +0 -0
@@ -0,0 +1 @@
1
+ 0.13.5
@@ -1,7 +1,7 @@
1
1
  include CODE_VERSION.cfg
2
- include requirements.txt
3
2
  include README.md
4
3
  include LICENSE
4
+ include pyproject.toml
5
5
  recursive-include libinephany *.py
6
6
  recursive-exclude * __pycache__
7
7
  recursive-exclude * *.py[co]
@@ -1,13 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libinephany
3
- Version: 0.13.3
3
+ Version: 0.13.5
4
4
  Summary: Inephany library containing code commonly used by multiple subpackages.
5
- Requires-Python: >=3.6
5
+ Author-email: Inephany <info@inephany.com>
6
+ License: Apache 2.0
7
+ Keywords: libinephany,library,utilities
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Python: >=3.10
6
15
  Description-Content-Type: text/markdown
7
16
  License-File: LICENSE
8
- Requires-Dist: pytest<9.0.0,>=7.0.0
9
- Requires-Dist: pytest-mock<4.0.0,>=3.10.0
10
- Requires-Dist: pytest-asyncio<0.26.0,>=0.21.0
11
17
  Requires-Dist: pydantic<3.0.0,>=2.5.0
12
18
  Requires-Dist: loguru<0.8.0,>=0.7.0
13
19
  Requires-Dist: requests<3.0.0,>=2.28.0
@@ -22,6 +28,9 @@ Requires-Dist: pandas<3.0.0,>=2.0.0
22
28
  Requires-Dist: accelerate<2.0.0,>=0.20.0
23
29
  Requires-Dist: gymnasium<2.0.0,>=0.29.0
24
30
  Provides-Extra: dev
31
+ Requires-Dist: pytest<9.0.0,>=7.0.0; extra == "dev"
32
+ Requires-Dist: pytest-mock<4.0.0,>=3.10.0; extra == "dev"
33
+ Requires-Dist: pytest-asyncio<0.26.0,>=0.21.0; extra == "dev"
25
34
  Requires-Dist: bump-my-version==0.11.0; extra == "dev"
26
35
  Requires-Dist: black==24.4.2; extra == "dev"
27
36
  Requires-Dist: isort==5.9.3; extra == "dev"
@@ -31,7 +40,6 @@ Requires-Dist: mypy==1.13.0; extra == "dev"
31
40
  Requires-Dist: types-PyYAML==6.0.12.20240808; extra == "dev"
32
41
  Requires-Dist: typeguard==4.3.0; extra == "dev"
33
42
  Dynamic: license-file
34
- Dynamic: requires-python
35
43
 
36
44
  # Inephany Common Library
37
45
 
@@ -50,20 +58,19 @@ The Inephany Common Library (`libinephany`) is a core utility package that provi
50
58
 
51
59
  ### Prerequisites
52
60
 
53
- - Python 3.12+
61
+ - Python 3.10+
54
62
  - Make (for build automation)
55
63
 
56
64
  #### Ubuntu / Debian
57
65
  ```bash
58
66
  sudo add-apt-repository ppa:deadsnakes/ppa
59
67
  sudo apt update
60
- sudo apt install python3.12 make
68
+ sudo apt install python3.12
61
69
  ```
62
70
 
63
71
  #### MacOS with brew
64
72
  ```bash
65
73
  brew install python@3.12
66
- brew install make
67
74
  ```
68
75
 
69
76
  ### For Developers (Monorepo)
@@ -72,33 +79,17 @@ If you're working within the Inephany monorepo, the package is already available
72
79
 
73
80
  ### For Clients (Standalone Installation)
74
81
 
75
- Since `libinephany` is not yet published on PyPI, you'll need to build and install it manually from source. Follow these steps:
82
+ `libinephany` is available on PyPI and can be installed directly:
76
83
 
77
- 1. **Create a new virtual environment**
78
- ```bash
79
- python3.12 -m venv myenv
80
- ```
81
-
82
- 2. **Activate the virtual environment**
83
- ```bash
84
- source myenv/bin/activate
85
- ```
86
-
87
- 3. **Install Build Tools**
88
- ```bash
89
- python -m pip install --upgrade pip setuptools build wheel
90
- ```
84
+ ```bash
85
+ pip install libinephany
86
+ ```
91
87
 
92
- 4. **Change into the `libinephany` directory**
88
+ For development installations with additional dependencies:
93
89
 
94
- 5. **Build and install `libinephany`**
95
- ```bash
96
- python -m build
97
- pip install dist/libinephany-<version>-py3-none-any.whl
98
- ```
99
- Replace `<version>` with the actual version number of the built wheel.
100
-
101
- **Note**: Once `libinephany` is published to PyPI, you'll be able to install it with `pip install libinephany`.
90
+ ```bash
91
+ pip install libinephany[dev]
92
+ ```
102
93
 
103
94
  ## Key Components
104
95
 
@@ -279,4 +270,4 @@ When contributing to `libinephany`:
279
270
 
280
271
  ## License
281
272
 
282
- This package is part of the Inephany ecosystem and is subject to the same licensing terms as other Inephany packages.
273
+ This package is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
@@ -15,20 +15,19 @@ The Inephany Common Library (`libinephany`) is a core utility package that provi
15
15
 
16
16
  ### Prerequisites
17
17
 
18
- - Python 3.12+
18
+ - Python 3.10+
19
19
  - Make (for build automation)
20
20
 
21
21
  #### Ubuntu / Debian
22
22
  ```bash
23
23
  sudo add-apt-repository ppa:deadsnakes/ppa
24
24
  sudo apt update
25
- sudo apt install python3.12 make
25
+ sudo apt install python3.12
26
26
  ```
27
27
 
28
28
  #### MacOS with brew
29
29
  ```bash
30
30
  brew install python@3.12
31
- brew install make
32
31
  ```
33
32
 
34
33
  ### For Developers (Monorepo)
@@ -37,33 +36,17 @@ If you're working within the Inephany monorepo, the package is already available
37
36
 
38
37
  ### For Clients (Standalone Installation)
39
38
 
40
- Since `libinephany` is not yet published on PyPI, you'll need to build and install it manually from source. Follow these steps:
39
+ `libinephany` is available on PyPI and can be installed directly:
41
40
 
42
- 1. **Create a new virtual environment**
43
- ```bash
44
- python3.12 -m venv myenv
45
- ```
46
-
47
- 2. **Activate the virtual environment**
48
- ```bash
49
- source myenv/bin/activate
50
- ```
51
-
52
- 3. **Install Build Tools**
53
- ```bash
54
- python -m pip install --upgrade pip setuptools build wheel
55
- ```
41
+ ```bash
42
+ pip install libinephany
43
+ ```
56
44
 
57
- 4. **Change into the `libinephany` directory**
45
+ For development installations with additional dependencies:
58
46
 
59
- 5. **Build and install `libinephany`**
60
- ```bash
61
- python -m build
62
- pip install dist/libinephany-<version>-py3-none-any.whl
63
- ```
64
- Replace `<version>` with the actual version number of the built wheel.
65
-
66
- **Note**: Once `libinephany` is published to PyPI, you'll be able to install it with `pip install libinephany`.
47
+ ```bash
48
+ pip install libinephany[dev]
49
+ ```
67
50
 
68
51
  ## Key Components
69
52
 
@@ -244,4 +227,4 @@ When contributing to `libinephany`:
244
227
 
245
228
  ## License
246
229
 
247
- This package is part of the Inephany ecosystem and is subject to the same licensing terms as other Inephany packages.
230
+ This package is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
@@ -929,8 +929,9 @@ class ModelFamilyOneHot(GlobalObserver):
929
929
  """
930
930
 
931
931
  family_name = self.observer_config.nn_family_name
932
+ known_name = family_name in (family.value for family in ModelFamilies)
932
933
 
933
- if family_name in ModelFamilies:
934
+ if known_name:
934
935
  family_idx = ModelFamilies.get_index(family_name)
935
936
 
936
937
  else:
@@ -64,6 +64,14 @@ class StatisticManager:
64
64
  self.tensor_stats_downsample_percentage = tensor_stats_downsample_percentage
65
65
  self.statistic_sample_frequency = statistic_sample_frequency
66
66
 
67
+ @property
68
+ def requires_gradient_graphs(self) -> bool:
69
+ """
70
+ :return: Whether the manager requires gradient graphs to be retained.
71
+ """
72
+
73
+ return any(tracker.requires_gradient_graphs for tracker in self._trackers.values())
74
+
67
75
  @staticmethod
68
76
  def _nullify_gradients(model: nn.Module) -> None:
69
77
  """
@@ -438,6 +438,14 @@ class SecondOrderGradients(Statistic):
438
438
  self.compute_hessian_diagonal = compute_hessian_diagonal
439
439
  self.skip_statistics = skip_statistics
440
440
 
441
+ @property
442
+ def requires_gradient_graphs(self) -> bool:
443
+ """
444
+ :return: Whether the statistic requires gradient graphs to be retained.
445
+ """
446
+
447
+ return self.compute_hessian_diagonal
448
+
441
449
  def _get_storage_format(self) -> StatisticStorageTypes:
442
450
  """
443
451
  :return: Storage format this observation stores data in. Must be one of the enum attributes in the
@@ -262,6 +262,21 @@ class TokensHParamConfig(HParamConfig):
262
262
  sample_step: int = int(1e6)
263
263
 
264
264
 
265
+ class SamplesHParamConfig(HParamConfig):
266
+ max_hparam_value: float | int = 1e9
267
+ min_hparam_value: float | int = 1e4
268
+ hparam_dtype: type[float | int] = int
269
+ initial_value: int = int(1e5)
270
+ initial_delta: float = 0.0
271
+ scale: float = 1.0
272
+
273
+ sampler: str = "DiscreteRangeSampler"
274
+ sample_initial_values: bool = False
275
+ sample_lower_bound: int = int(1e4)
276
+ sample_upper_bound: int = int(1e7)
277
+ sample_step: int = int(1e4)
278
+
279
+
265
280
  class HParamConfigs(BaseModel):
266
281
 
267
282
  learning_rate_config: HParamConfig = LearningRateHParamConfig()
@@ -276,6 +291,7 @@ class HParamConfigs(BaseModel):
276
291
  batch_size_config: HParamConfig = BatchSizeHParamConfig()
277
292
  epochs_config: HParamConfig = EpochsHParamConfig()
278
293
  token_config: HParamConfig = TokensHParamConfig()
294
+ samples_config: HParamConfig = SamplesHParamConfig()
279
295
 
280
296
  def override(self, overrides: dict[str, dict[str, Any]] | None) -> None:
281
297
  """
@@ -337,6 +353,9 @@ class HParamConfigs(BaseModel):
337
353
  case AgentTypes.Tokens:
338
354
  self.token_config = hparam_config
339
355
 
356
+ case AgentTypes.Samples:
357
+ self.samples_config = hparam_config
358
+
340
359
  case _:
341
360
  raise ValueError(f"Unknown agent type: {agent_type.value}.")
342
361
 
@@ -383,5 +402,8 @@ class HParamConfigs(BaseModel):
383
402
  case AgentTypes.Tokens:
384
403
  return self.token_config
385
404
 
405
+ case AgentTypes.Samples:
406
+ return self.samples_config
407
+
386
408
  case _:
387
409
  raise ValueError(f"Unknown agent type: {agent_type.value}.")
@@ -21,6 +21,7 @@ from libinephany.utils.constants import (
21
21
  EPOCHS,
22
22
  GRAD_NORM_CLIP,
23
23
  LEARNING_RATE,
24
+ SAMPLES,
24
25
  SGD_MOMENTUM,
25
26
  TOKENS,
26
27
  WEIGHT_DECAY,
@@ -164,7 +165,7 @@ class Hyperparameter(BaseModel):
164
165
  @external_value.setter
165
166
  def external_value(self, new_external_value: float | int | None) -> None:
166
167
  """
167
- :param new_value: New external value to set the hyperparameter to.
168
+ :param new_external_value: New external value to set the hyperparameter to.
168
169
  """
169
170
 
170
171
  if new_external_value is None:
@@ -183,7 +184,7 @@ class Hyperparameter(BaseModel):
183
184
  @internal_value.setter
184
185
  def internal_value(self, new_internal_value: float | int | None) -> None:
185
186
  """
186
- :param new_value: New internal value to set the hyperparameter to.
187
+ :param new_internal_value: New internal value to set the hyperparameter to.
187
188
  """
188
189
 
189
190
  self.current_internal_value = new_internal_value
@@ -221,7 +222,7 @@ class Hyperparameter(BaseModel):
221
222
 
222
223
  def set_sampled_initial_value(self, initial_external_value: float | int | None) -> None:
223
224
  """
224
- :param sample_external_value: Sampled external value to set the hyperparameter to.
225
+ :param initial_external_value: Sampled external value to set the hyperparameter to.
225
226
  """
226
227
 
227
228
  if initial_external_value is None:
@@ -312,7 +313,8 @@ class HyperparameterContainer(BaseModel):
312
313
  self, sample_initial_external_values: dict[str, np.ndarray | float | int | None]
313
314
  ) -> None:
314
315
  """
315
- :param samples: Dictionary mapping hyperparameter names to newly sampled initial external values.
316
+ :param sample_initial_external_values: Dictionary mapping hyperparameter names to newly sampled initial
317
+ external values.
316
318
  """
317
319
 
318
320
  for hyperparameter_name, initial_external_value in sample_initial_external_values.items():
@@ -436,6 +438,7 @@ class GlobalHParams(HyperparameterContainer):
436
438
  batch_size: Hyperparameter
437
439
  epochs: Hyperparameter
438
440
  tokens: Hyperparameter
441
+ samples: Hyperparameter
439
442
 
440
443
  @classmethod
441
444
  def build(
@@ -489,6 +492,7 @@ class HyperparameterStates(BaseModel):
489
492
  global_hparams: GlobalHParams
490
493
  parameter_group_hparams: dict[str, ParameterGroupHParams] = {}
491
494
  initial_hyperparameter_internal_values: dict[str, float | int] = {}
495
+ initial_hyperparameter_external_values: dict[str, float | int] = {}
492
496
 
493
497
  batches_processed: int = 0
494
498
  tokens_processed: int = 0
@@ -513,7 +517,7 @@ class HyperparameterStates(BaseModel):
513
517
  if INITIAL_PREFIX in item:
514
518
  hyperparameter_name = item.replace(INITIAL_PREFIX, "")
515
519
 
516
- return self.initial_hyperparameter_internal_values[hyperparameter_name]
520
+ return self.initial_hyperparameter_external_values[hyperparameter_name]
517
521
 
518
522
  return super().__getattr__(item) # type: ignore
519
523
 
@@ -542,6 +546,15 @@ class HyperparameterStates(BaseModel):
542
546
 
543
547
  return self.global_hparams.tokens
544
548
 
549
+ @computed_field # type: ignore[misc]
550
+ @property
551
+ def samples(self) -> Hyperparameter:
552
+ """
553
+ :return: Samples hyperparameter.
554
+ """
555
+
556
+ return self.global_hparams.samples
557
+
545
558
  @property
546
559
  def max_tokens_to_process(self) -> int | None:
547
560
  """
@@ -602,6 +615,7 @@ class HyperparameterStates(BaseModel):
602
615
  hparam_samplers=hparam_samplers,
603
616
  global_hparams=global_hparams,
604
617
  initial_hyperparameter_internal_values=initial_hyperparameter_internal_values,
618
+ initial_hyperparameter_external_values=initial_hyperparameter_external_values,
605
619
  )
606
620
 
607
621
  inner_task_state.add_parameter_groups(parameter_group_names=parameter_group_names)
@@ -643,6 +657,7 @@ class HyperparameterStates(BaseModel):
643
657
  BATCH_SIZE: hparam_configs.batch_size_config,
644
658
  EPOCHS: hparam_configs.epochs_config,
645
659
  TOKENS: hparam_configs.token_config,
660
+ SAMPLES: hparam_configs.samples_config,
646
661
  }
647
662
 
648
663
  @staticmethod
@@ -774,6 +789,7 @@ class HyperparameterStates(BaseModel):
774
789
  hparam_configs=self.hparam_configs,
775
790
  )
776
791
 
792
+ self.initial_hyperparameter_external_values.update(external_value_samples) # type: ignore
777
793
  self.initial_hyperparameter_internal_values.update(internal_value_samples) # type: ignore
778
794
 
779
795
  def set_to_initial_values(self) -> None:
@@ -23,6 +23,7 @@ SGD_MOMENTUM = "sgd_momentum"
23
23
  BATCH_SIZE = "batch_size"
24
24
  EPOCHS = "epochs"
25
25
  TOKENS = "tokens"
26
+ SAMPLES = "samples"
26
27
 
27
28
  PARAMS = "params"
28
29
 
@@ -15,6 +15,7 @@ from libinephany.utils.constants import (
15
15
  EPOCHS,
16
16
  GRAD_NORM_CLIP,
17
17
  LEARNING_RATE,
18
+ SAMPLES,
18
19
  SGD_MOMENTUM,
19
20
  TOKENS,
20
21
  WEIGHT_DECAY,
@@ -73,6 +74,7 @@ class AgentTypes(EnumWithIndices):
73
74
  BatchSize = BATCH_SIZE
74
75
  Epochs = EPOCHS
75
76
  Tokens = TOKENS
77
+ Samples = SAMPLES
76
78
 
77
79
 
78
80
  class ModelFamilies(EnumWithIndices):
@@ -1,13 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libinephany
3
- Version: 0.13.3
3
+ Version: 0.13.5
4
4
  Summary: Inephany library containing code commonly used by multiple subpackages.
5
- Requires-Python: >=3.6
5
+ Author-email: Inephany <info@inephany.com>
6
+ License: Apache 2.0
7
+ Keywords: libinephany,library,utilities
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Python: >=3.10
6
15
  Description-Content-Type: text/markdown
7
16
  License-File: LICENSE
8
- Requires-Dist: pytest<9.0.0,>=7.0.0
9
- Requires-Dist: pytest-mock<4.0.0,>=3.10.0
10
- Requires-Dist: pytest-asyncio<0.26.0,>=0.21.0
11
17
  Requires-Dist: pydantic<3.0.0,>=2.5.0
12
18
  Requires-Dist: loguru<0.8.0,>=0.7.0
13
19
  Requires-Dist: requests<3.0.0,>=2.28.0
@@ -22,6 +28,9 @@ Requires-Dist: pandas<3.0.0,>=2.0.0
22
28
  Requires-Dist: accelerate<2.0.0,>=0.20.0
23
29
  Requires-Dist: gymnasium<2.0.0,>=0.29.0
24
30
  Provides-Extra: dev
31
+ Requires-Dist: pytest<9.0.0,>=7.0.0; extra == "dev"
32
+ Requires-Dist: pytest-mock<4.0.0,>=3.10.0; extra == "dev"
33
+ Requires-Dist: pytest-asyncio<0.26.0,>=0.21.0; extra == "dev"
25
34
  Requires-Dist: bump-my-version==0.11.0; extra == "dev"
26
35
  Requires-Dist: black==24.4.2; extra == "dev"
27
36
  Requires-Dist: isort==5.9.3; extra == "dev"
@@ -31,7 +40,6 @@ Requires-Dist: mypy==1.13.0; extra == "dev"
31
40
  Requires-Dist: types-PyYAML==6.0.12.20240808; extra == "dev"
32
41
  Requires-Dist: typeguard==4.3.0; extra == "dev"
33
42
  Dynamic: license-file
34
- Dynamic: requires-python
35
43
 
36
44
  # Inephany Common Library
37
45
 
@@ -50,20 +58,19 @@ The Inephany Common Library (`libinephany`) is a core utility package that provi
50
58
 
51
59
  ### Prerequisites
52
60
 
53
- - Python 3.12+
61
+ - Python 3.10+
54
62
  - Make (for build automation)
55
63
 
56
64
  #### Ubuntu / Debian
57
65
  ```bash
58
66
  sudo add-apt-repository ppa:deadsnakes/ppa
59
67
  sudo apt update
60
- sudo apt install python3.12 make
68
+ sudo apt install python3.12
61
69
  ```
62
70
 
63
71
  #### MacOS with brew
64
72
  ```bash
65
73
  brew install python@3.12
66
- brew install make
67
74
  ```
68
75
 
69
76
  ### For Developers (Monorepo)
@@ -72,33 +79,17 @@ If you're working within the Inephany monorepo, the package is already available
72
79
 
73
80
  ### For Clients (Standalone Installation)
74
81
 
75
- Since `libinephany` is not yet published on PyPI, you'll need to build and install it manually from source. Follow these steps:
82
+ `libinephany` is available on PyPI and can be installed directly:
76
83
 
77
- 1. **Create a new virtual environment**
78
- ```bash
79
- python3.12 -m venv myenv
80
- ```
81
-
82
- 2. **Activate the virtual environment**
83
- ```bash
84
- source myenv/bin/activate
85
- ```
86
-
87
- 3. **Install Build Tools**
88
- ```bash
89
- python -m pip install --upgrade pip setuptools build wheel
90
- ```
84
+ ```bash
85
+ pip install libinephany
86
+ ```
91
87
 
92
- 4. **Change into the `libinephany` directory**
88
+ For development installations with additional dependencies:
93
89
 
94
- 5. **Build and install `libinephany`**
95
- ```bash
96
- python -m build
97
- pip install dist/libinephany-<version>-py3-none-any.whl
98
- ```
99
- Replace `<version>` with the actual version number of the built wheel.
100
-
101
- **Note**: Once `libinephany` is published to PyPI, you'll be able to install it with `pip install libinephany`.
90
+ ```bash
91
+ pip install libinephany[dev]
92
+ ```
102
93
 
103
94
  ## Key Components
104
95
 
@@ -279,4 +270,4 @@ When contributing to `libinephany`:
279
270
 
280
271
  ## License
281
272
 
282
- This package is part of the Inephany ecosystem and is subject to the same licensing terms as other Inephany packages.
273
+ This package is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
@@ -3,8 +3,6 @@ LICENSE
3
3
  MANIFEST.in
4
4
  README.md
5
5
  pyproject.toml
6
- requirements.txt
7
- setup.py
8
6
  libinephany/__init__.py
9
7
  libinephany.egg-info/PKG-INFO
10
8
  libinephany.egg-info/SOURCES.txt
@@ -7,11 +7,21 @@ name = "libinephany"
7
7
  dynamic = ["version"]
8
8
  description = "Inephany library containing code commonly used by multiple subpackages."
9
9
  readme = "README.md"
10
- requires-python = ">=3.6"
10
+ requires-python = ">=3.10"
11
+ authors = [
12
+ {name = "Inephany", email = "info@inephany.com"}
13
+ ]
14
+ license = {text = "Apache 2.0"}
15
+ keywords = ["libinephany", "library", "utilities"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ ]
11
24
  dependencies = [
12
- "pytest>=7.0.0,<9.0.0",
13
- "pytest-mock>=3.10.0,<4.0.0",
14
- "pytest-asyncio>=0.21.0,<0.26.0",
15
25
  "pydantic>=2.5.0,<3.0.0",
16
26
  "loguru>=0.7.0,<0.8.0",
17
27
  "requests>=2.28.0,<3.0.0",
@@ -29,6 +39,9 @@ dependencies = [
29
39
 
30
40
  [project.optional-dependencies]
31
41
  dev = [
42
+ "pytest>=7.0.0,<9.0.0",
43
+ "pytest-mock>=3.10.0,<4.0.0",
44
+ "pytest-asyncio>=0.21.0,<0.26.0",
32
45
  "bump-my-version==0.11.0",
33
46
  "black==24.4.2",
34
47
  "isort==5.9.3",
@@ -1 +0,0 @@
1
- 0.13.3
@@ -1,16 +0,0 @@
1
- pytest>=7.0.0,<9.0.0
2
- pytest-mock>=3.10.0,<4.0.0
3
- pytest-asyncio>=0.21.0,<0.26.0
4
- pydantic>=2.5.0,<3.0.0
5
- loguru>=0.7.0,<0.8.0
6
- requests>=2.28.0,<3.0.0
7
- numpy>=1.24.0,<2.0.0
8
- slack-sdk>=3.20.0,<4.0.0
9
- boto3>=1.26.0,<2.0.0
10
- fastapi>=0.100.0,<0.116.0
11
- aiohttp>=3.8.0,<4.0.0
12
- torch>=2.1.0,<2.8.0
13
- transformers>=4.30.0,<4.48.3
14
- pandas>=2.0.0,<3.0.0
15
- accelerate>=0.20.0,<2.0.0
16
- gymnasium>=0.29.0,<2.0.0
@@ -1,61 +0,0 @@
1
- # ======================================================================================================================
2
- #
3
- # IMPORTS
4
- #
5
- # ======================================================================================================================
6
-
7
- import os
8
- from typing import List
9
-
10
- from setuptools import find_packages, setup
11
-
12
- # ======================================================================================================================
13
-
14
-
15
- def get_path_to_this_files_parent_dir() -> str:
16
- return os.path.dirname(os.path.abspath(__file__))
17
-
18
-
19
- def get_path_to_requirements_txt_relative_to_this_file() -> str:
20
- return os.path.join(get_path_to_this_files_parent_dir(), "requirements.txt")
21
-
22
-
23
- def load_required_packages_from_requirements_txt() -> List[str]:
24
- with open(get_path_to_requirements_txt_relative_to_this_file(), "r") as file:
25
- return [ln.strip() for ln in file.readlines()]
26
-
27
-
28
- def get_version_number() -> str:
29
- version_file_path = os.path.join(get_path_to_this_files_parent_dir(), "CODE_VERSION.cfg")
30
- with open(version_file_path) as version_file:
31
- version = version_file.read().strip()
32
- return version
33
-
34
-
35
- setup(
36
- # =====
37
- # Setup
38
- # =====
39
- name="libinephany",
40
- version=get_version_number(),
41
- description="Inephany library containing code commonly used by multiple subpackages.",
42
- # =================================
43
- # Actual packages, data and scripts
44
- # =================================
45
- packages=find_packages(),
46
- package_dir={"libinephany": "libinephany"},
47
- install_requires=load_required_packages_from_requirements_txt(),
48
- extras_require={
49
- "dev": [
50
- "bump-my-version==0.11.0",
51
- "black==24.4.2",
52
- "isort==5.9.3",
53
- "flake8==7.1.0",
54
- "pre-commit==4.0.1",
55
- "mypy==1.13.0",
56
- "types-PyYAML==6.0.12.20240808",
57
- "typeguard==4.3.0",
58
- ]
59
- },
60
- python_requires=">=3.6",
61
- )
File without changes
@@ -1,6 +1,3 @@
1
- pytest<9.0.0,>=7.0.0
2
- pytest-mock<4.0.0,>=3.10.0
3
- pytest-asyncio<0.26.0,>=0.21.0
4
1
  pydantic<3.0.0,>=2.5.0
5
2
  loguru<0.8.0,>=0.7.0
6
3
  requests<3.0.0,>=2.28.0
@@ -16,6 +13,9 @@ accelerate<2.0.0,>=0.20.0
16
13
  gymnasium<2.0.0,>=0.29.0
17
14
 
18
15
  [dev]
16
+ pytest<9.0.0,>=7.0.0
17
+ pytest-mock<4.0.0,>=3.10.0
18
+ pytest-asyncio<0.26.0,>=0.21.0
19
19
  bump-my-version==0.11.0
20
20
  black==24.4.2
21
21
  isort==5.9.3
File without changes