libinephany 0.13.3__tar.gz → 0.13.6__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.
- libinephany-0.13.6/CODE_VERSION.cfg +1 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/MANIFEST.in +1 -1
- {libinephany-0.13.3/libinephany.egg-info → libinephany-0.13.6}/PKG-INFO +25 -34
- {libinephany-0.13.3 → libinephany-0.13.6}/README.md +11 -28
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observers/global_observers.py +4 -1
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/statistic_manager.py +8 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/statistic_trackers.py +8 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/configs/hyperparameter_configs.py +22 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/configs/outer_model_config.py +1 -6
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/states/hyperparameter_states.py +21 -5
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/constants.py +1 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/enums.py +2 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/import_utils.py +9 -0
- {libinephany-0.13.3 → libinephany-0.13.6/libinephany.egg-info}/PKG-INFO +25 -34
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany.egg-info/SOURCES.txt +0 -2
- {libinephany-0.13.3 → libinephany-0.13.6}/pyproject.toml +17 -4
- libinephany-0.13.3/CODE_VERSION.cfg +0 -1
- libinephany-0.13.3/requirements.txt +0 -16
- libinephany-0.13.3/setup.py +0 -61
- {libinephany-0.13.3 → libinephany-0.13.6}/LICENSE +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/aws/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/aws/s3_functions.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observation_utils.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observer_pipeline.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observers/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observers/base_observers.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observers/local_observers.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observers/observer_containers.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/pipeline_coordinator.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/post_processors/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/post_processors/postprocessors.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/configs/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/configs/observer_config.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/agent_info.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/inner_task_profile.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/observation_models.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/request_schemas.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/response_schemas.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/tensor_statistics.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/states/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/agent_utils.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/asyncio_worker.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/backend_statuses.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/directory_utils.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/dropout_utils.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/error_severities.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/exceptions.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/optim_utils.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/random_seeds.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/samplers.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/standardizers.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/torch_distributed_utils.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/torch_utils.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/transforms.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/utils/typing.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/web_apps/__init__.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/web_apps/error_logger.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany/web_apps/web_app_utils.py +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany.egg-info/dependency_links.txt +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany.egg-info/requires.txt +3 -3
- {libinephany-0.13.3 → libinephany-0.13.6}/libinephany.egg-info/top_level.txt +0 -0
- {libinephany-0.13.3 → libinephany-0.13.6}/setup.cfg +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
0.13.6
|
@@ -1,13 +1,19 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: libinephany
|
3
|
-
Version: 0.13.
|
3
|
+
Version: 0.13.6
|
4
4
|
Summary: Inephany library containing code commonly used by multiple subpackages.
|
5
|
-
|
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.
|
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
|
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
|
-
|
82
|
+
`libinephany` is available on PyPI and can be installed directly:
|
76
83
|
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
88
|
+
For development installations with additional dependencies:
|
93
89
|
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
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.
|
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
|
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
|
-
|
39
|
+
`libinephany` is available on PyPI and can be installed directly:
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
45
|
+
For development installations with additional dependencies:
|
58
46
|
|
59
|
-
|
60
|
-
|
61
|
-
|
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
|
230
|
+
This package is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observers/global_observers.py
RENAMED
@@ -36,6 +36,8 @@ class InitialHyperparameters(GlobalObserver):
|
|
36
36
|
|
37
37
|
super().__init__(**kwargs)
|
38
38
|
|
39
|
+
force_skip = ["samples"]
|
40
|
+
skip_hparams = force_skip if skip_hparams is None else skip_hparams + force_skip
|
39
41
|
self.skip_hparams = [] if skip_hparams is None else skip_hparams
|
40
42
|
self.pad_with = pad_with
|
41
43
|
|
@@ -929,8 +931,9 @@ class ModelFamilyOneHot(GlobalObserver):
|
|
929
931
|
"""
|
930
932
|
|
931
933
|
family_name = self.observer_config.nn_family_name
|
934
|
+
known_name = family_name in (family.value for family in ModelFamilies)
|
932
935
|
|
933
|
-
if
|
936
|
+
if known_name:
|
934
937
|
family_idx = ModelFamilies.get_index(family_name)
|
935
938
|
|
936
939
|
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}.")
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/configs/outer_model_config.py
RENAMED
@@ -12,11 +12,7 @@
|
|
12
12
|
|
13
13
|
try:
|
14
14
|
# Re-export all classes from libipcode to maintain backward compatibility
|
15
|
-
from libipcode.pydantic_models.configs.outer_model_config import
|
16
|
-
OuterModelConfig,
|
17
|
-
SharedActorCriticConfig,
|
18
|
-
SoleAgentConfig,
|
19
|
-
)
|
15
|
+
from libipcode.pydantic_models.configs.outer_model_config import OuterModelConfig, SharedActorCriticConfig
|
20
16
|
except ImportError:
|
21
17
|
# If libipcode is not available, provide a fallback or raise a more helpful error
|
22
18
|
raise ImportError(
|
@@ -28,5 +24,4 @@ except ImportError:
|
|
28
24
|
__all__ = [
|
29
25
|
"OuterModelConfig",
|
30
26
|
"SharedActorCriticConfig",
|
31
|
-
"SoleAgentConfig",
|
32
27
|
]
|
@@ -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
|
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
|
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
|
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
|
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.
|
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:
|
@@ -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):
|
@@ -14,6 +14,7 @@ from types import ModuleType
|
|
14
14
|
# ======================================================================================================================
|
15
15
|
|
16
16
|
WANDB = "wandb"
|
17
|
+
LIGHTNING = "lightning"
|
17
18
|
|
18
19
|
# ======================================================================================================================
|
19
20
|
#
|
@@ -41,3 +42,11 @@ def try_import_wandb() -> ModuleType | None:
|
|
41
42
|
"""
|
42
43
|
|
43
44
|
return try_to_import_module(module_name=WANDB)
|
45
|
+
|
46
|
+
|
47
|
+
def try_import_lightning() -> ModuleType | None:
|
48
|
+
"""
|
49
|
+
:return: None or the imported lightning module.
|
50
|
+
"""
|
51
|
+
|
52
|
+
return try_to_import_module(module_name=LIGHTNING)
|
@@ -1,13 +1,19 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: libinephany
|
3
|
-
Version: 0.13.
|
3
|
+
Version: 0.13.6
|
4
4
|
Summary: Inephany library containing code commonly used by multiple subpackages.
|
5
|
-
|
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.
|
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
|
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
|
-
|
82
|
+
`libinephany` is available on PyPI and can be installed directly:
|
76
83
|
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
88
|
+
For development installations with additional dependencies:
|
93
89
|
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
273
|
+
This package is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
|
@@ -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.
|
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
|
libinephany-0.13.3/setup.py
DELETED
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observers/base_observers.py
RENAMED
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observers/local_observers.py
RENAMED
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/observers/observer_containers.py
RENAMED
File without changes
|
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/post_processors/__init__.py
RENAMED
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/observations/post_processors/postprocessors.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/configs/observer_config.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/inner_task_profile.py
RENAMED
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/observation_models.py
RENAMED
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/request_schemas.py
RENAMED
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/response_schemas.py
RENAMED
File without changes
|
{libinephany-0.13.3 → libinephany-0.13.6}/libinephany/pydantic_models/schemas/tensor_statistics.py
RENAMED
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
|
File without changes
|
File without changes
|
File without changes
|
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
|
File without changes
|