libinephany 0.13.7__py3-none-any.whl → 0.14.0__py3-none-any.whl
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/observations/observers/local_observers.py +4 -3
- libinephany/pydantic_models/configs/hyperparameter_configs.py +4 -0
- libinephany/pydantic_models/schemas/response_schemas.py +18 -0
- libinephany/pydantic_models/states/hyperparameter_states.py +54 -33
- {libinephany-0.13.7.dist-info → libinephany-0.14.0.dist-info}/METADATA +1 -1
- {libinephany-0.13.7.dist-info → libinephany-0.14.0.dist-info}/RECORD +9 -9
- {libinephany-0.13.7.dist-info → libinephany-0.14.0.dist-info}/WHEEL +0 -0
- {libinephany-0.13.7.dist-info → libinephany-0.14.0.dist-info}/licenses/LICENSE +0 -0
- {libinephany-0.13.7.dist-info → libinephany-0.14.0.dist-info}/top_level.txt +0 -0
@@ -6,14 +6,13 @@
|
|
6
6
|
|
7
7
|
from typing import Any
|
8
8
|
|
9
|
-
from loguru import logger
|
10
|
-
|
11
9
|
from libinephany.observations import observation_utils, statistic_trackers
|
12
10
|
from libinephany.observations.observation_utils import StatisticStorageTypes
|
13
11
|
from libinephany.observations.observers.base_observers import LocalObserver
|
14
12
|
from libinephany.pydantic_models.schemas.observation_models import ObservationInputs
|
15
13
|
from libinephany.pydantic_models.schemas.tensor_statistics import TensorStatistics
|
16
14
|
from libinephany.pydantic_models.states.hyperparameter_states import HyperparameterStates
|
15
|
+
from libinephany.utils import exceptions
|
17
16
|
from libinephany.utils.enums import ModuleTypes
|
18
17
|
from libinephany.utils.transforms import HyperparameterTransformType
|
19
18
|
|
@@ -412,7 +411,9 @@ class ActionSchemeOneHot(LocalObserver):
|
|
412
411
|
def __init__(self, **kwargs) -> None:
|
413
412
|
super().__init__(**kwargs)
|
414
413
|
|
415
|
-
|
414
|
+
exceptions.warn_once(
|
415
|
+
f"{str(self.__class__.__name__)} is deprecated and will be removed in an upcoming release."
|
416
|
+
)
|
416
417
|
|
417
418
|
@property
|
418
419
|
def vector_length(self) -> int:
|
@@ -293,6 +293,10 @@ class HParamConfigs(BaseModel):
|
|
293
293
|
token_config: HParamConfig = TokensHParamConfig()
|
294
294
|
samples_config: HParamConfig = SamplesHParamConfig()
|
295
295
|
|
296
|
+
constraints: dict[str, dict[str, Any] | None] | None = {
|
297
|
+
"FirstDefaultParamorphConstraint": None,
|
298
|
+
}
|
299
|
+
|
296
300
|
def override(self, overrides: dict[str, dict[str, Any]] | None) -> None:
|
297
301
|
"""
|
298
302
|
:param overrides: None or config overrides to apply.
|
@@ -37,6 +37,24 @@ class ClientScheduleResponse(BaseModel):
|
|
37
37
|
|
38
38
|
response_time: float | None = None
|
39
39
|
|
40
|
+
def get_value_mapping(self) -> dict[str, float | int]:
|
41
|
+
"""
|
42
|
+
:return: Dictionary mapping agent IDs to their values.
|
43
|
+
"""
|
44
|
+
|
45
|
+
return {
|
46
|
+
agent_id: agent_response.hyperparameter_internal_value for agent_id, agent_response in self.actions.items()
|
47
|
+
}
|
48
|
+
|
49
|
+
def set_values_from_mapping(self, values: dict[str, float | int]) -> None:
|
50
|
+
"""
|
51
|
+
:param values: Dictionary mapping agent IDs to their values.
|
52
|
+
"""
|
53
|
+
|
54
|
+
for agent_id, value in values.items():
|
55
|
+
if agent_id in self.actions:
|
56
|
+
self.actions[agent_id].hyperparameter_internal_value = value
|
57
|
+
|
40
58
|
|
41
59
|
class ClientPolicySchemaResponse(BaseModel):
|
42
60
|
observation_clipping_threshold: float
|
@@ -309,6 +309,56 @@ class HyperparameterContainer(BaseModel):
|
|
309
309
|
if isinstance(field_value, Hyperparameter) and field_name not in skip_hparams
|
310
310
|
}
|
311
311
|
|
312
|
+
def get_current_internal_values(self, skip_hparams: list[str] | None = None) -> dict[str, float | int | None]:
|
313
|
+
"""
|
314
|
+
:param skip_hparams: Names of the hyperparameters to not include in the current values vector returned by
|
315
|
+
this observation.
|
316
|
+
:return: Dictionary mapping hyperparameter names to their current values for this parameter group.
|
317
|
+
"""
|
318
|
+
|
319
|
+
if skip_hparams is None:
|
320
|
+
skip_hparams = []
|
321
|
+
|
322
|
+
return {
|
323
|
+
field_name: field_value.current_internal_value
|
324
|
+
for field_name, field_value in self.__dict__.items()
|
325
|
+
if isinstance(field_value, Hyperparameter) and field_name not in skip_hparams
|
326
|
+
}
|
327
|
+
|
328
|
+
def get_current_deltas(self, skip_hparams: list[str] | None = None) -> dict[str, float | int | None]:
|
329
|
+
"""
|
330
|
+
:param skip_hparams: Names of the hyperparameters to not include in the current deltas vector returned by
|
331
|
+
this observation.
|
332
|
+
:return: Dictionary mapping hyperparameter names to their current deltas for this parameter group.
|
333
|
+
"""
|
334
|
+
|
335
|
+
if skip_hparams is None:
|
336
|
+
skip_hparams = []
|
337
|
+
|
338
|
+
return {
|
339
|
+
field_name: field_value.current_delta
|
340
|
+
for field_name, field_value in self.__dict__.items()
|
341
|
+
if isinstance(field_value, Hyperparameter) and field_name not in skip_hparams
|
342
|
+
}
|
343
|
+
|
344
|
+
def set_internal_values(self, internal_values: dict[str, float | int | None]) -> None:
|
345
|
+
"""
|
346
|
+
:param internal_values: Dictionary mapping hyperparameter names to their new internal values.
|
347
|
+
"""
|
348
|
+
|
349
|
+
for field_name, field_value in internal_values.items():
|
350
|
+
if hasattr(self, field_name) and isinstance(getattr(self, field_name), Hyperparameter):
|
351
|
+
getattr(self, field_name).internal_value = field_value
|
352
|
+
|
353
|
+
def set_deltas(self, deltas: dict[str, float | int | None]) -> None:
|
354
|
+
"""
|
355
|
+
:param deltas: Dictionary mapping hyperparameter names to their new deltas.
|
356
|
+
"""
|
357
|
+
|
358
|
+
for field_name, field_value in deltas.items():
|
359
|
+
if hasattr(self, field_name) and isinstance(getattr(self, field_name), Hyperparameter):
|
360
|
+
getattr(self, field_name).delta = field_value
|
361
|
+
|
312
362
|
def set_sampled_initial_values(
|
313
363
|
self, sample_initial_external_values: dict[str, np.ndarray | float | int | None]
|
314
364
|
) -> None:
|
@@ -382,39 +432,10 @@ class ParameterGroupHParams(HyperparameterContainer):
|
|
382
432
|
name=hyperparameter_name,
|
383
433
|
)
|
384
434
|
|
385
|
-
return cls(
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
:param skip_hparams: Names of the hyperparameters to not include in the current values vector returned by
|
390
|
-
this observation.
|
391
|
-
:return: Dictionary mapping hyperparameter names to their current values for this parameter group.
|
392
|
-
"""
|
393
|
-
|
394
|
-
if skip_hparams is None:
|
395
|
-
skip_hparams = []
|
396
|
-
|
397
|
-
return {
|
398
|
-
field_name: field_value.current_internal_value
|
399
|
-
for field_name, field_value in self.__dict__.items()
|
400
|
-
if isinstance(field_value, Hyperparameter) and field_name not in skip_hparams
|
401
|
-
}
|
402
|
-
|
403
|
-
def get_current_deltas(self, skip_hparams: list[str] | None = None) -> dict[str, float | int | None]:
|
404
|
-
"""
|
405
|
-
:param skip_hparams: Names of the hyperparameters to not include in the current deltas vector returned by
|
406
|
-
this observation.
|
407
|
-
:return: Dictionary mapping hyperparameter names to their current deltas for this parameter group.
|
408
|
-
"""
|
409
|
-
|
410
|
-
if skip_hparams is None:
|
411
|
-
skip_hparams = []
|
412
|
-
|
413
|
-
return {
|
414
|
-
field_name: field_value.current_delta
|
415
|
-
for field_name, field_value in self.__dict__.items()
|
416
|
-
if isinstance(field_value, Hyperparameter) and field_name not in skip_hparams
|
417
|
-
}
|
435
|
+
return cls(
|
436
|
+
parameter_group_name=parameter_group_name,
|
437
|
+
**hyperparameters,
|
438
|
+
)
|
418
439
|
|
419
440
|
def get_hyperparameter_transform_types(
|
420
441
|
self, skip_hparams: list[str] | None = None
|
@@ -10,13 +10,13 @@ libinephany/observations/statistic_trackers.py,sha256=flkXquMHvY6YjnQAvRElsV5OUm
|
|
10
10
|
libinephany/observations/observers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
libinephany/observations/observers/base_observers.py,sha256=RkG5SW0b6Ooy0_oscRHxyB_YFNP7k8fxu37jBZElxIM,15418
|
12
12
|
libinephany/observations/observers/global_observers.py,sha256=-BJJaYjQSO82qskIlY_iijd3Lk1Ei1d3Hg1fzmYUPSM,38659
|
13
|
-
libinephany/observations/observers/local_observers.py,sha256=
|
13
|
+
libinephany/observations/observers/local_observers.py,sha256=EdivrylOcmxRsu4xiMwZqwmPX8Ru9-IRwoPk6En7qvw,37050
|
14
14
|
libinephany/observations/observers/observer_containers.py,sha256=g73ScbRRVTNbGEBb-Nyk8AQwoDhKZaqTd6OYP8FIcOs,8771
|
15
15
|
libinephany/observations/post_processors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
libinephany/observations/post_processors/postprocessors.py,sha256=43_e5UaDPr2KbAvqc_w3wLqnlm7bgRjqgCtyQ95-8cM,5913
|
17
17
|
libinephany/pydantic_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
18
|
libinephany/pydantic_models/configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
-
libinephany/pydantic_models/configs/hyperparameter_configs.py,sha256=
|
19
|
+
libinephany/pydantic_models/configs/hyperparameter_configs.py,sha256=5BH7aPiFtSfhTKp-Z0WTbCYuGJvUTskgFgMttxpDZb0,13654
|
20
20
|
libinephany/pydantic_models/configs/observer_config.py,sha256=v_ChzaVXC_rlZ7eDZPuCae1DdG7-PS3mPwC-OaWpGQo,1355
|
21
21
|
libinephany/pydantic_models/configs/outer_model_config.py,sha256=GQ0QBSC2Xht8x8X_TEMfYM2GF_x1kErLuFrA_H6Jhs0,1209
|
22
22
|
libinephany/pydantic_models/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -24,10 +24,10 @@ libinephany/pydantic_models/schemas/agent_info.py,sha256=me5gDxvZjP9TNK588mpUvxi
|
|
24
24
|
libinephany/pydantic_models/schemas/inner_task_profile.py,sha256=DBLdXeG_igZKp9t1A9bDiWPtaQ2r0rxKTGnpDpBjGlY,10344
|
25
25
|
libinephany/pydantic_models/schemas/observation_models.py,sha256=YjQmrWZ0r-_LRp92jvhSD8p1grKsMVXCXoou4q15Ue8,1849
|
26
26
|
libinephany/pydantic_models/schemas/request_schemas.py,sha256=VED8eAUvBofxeAx9gWU8DyCZOTVD3QsHRq-TO7kyOqk,1260
|
27
|
-
libinephany/pydantic_models/schemas/response_schemas.py,sha256=
|
27
|
+
libinephany/pydantic_models/schemas/response_schemas.py,sha256=SKFuasdjX5aH_I0vT3SwnpwhyMf9cNPB1ZpDeAGgoO8,2158
|
28
28
|
libinephany/pydantic_models/schemas/tensor_statistics.py,sha256=Z-x-Fi_Dm0pLoHI88DnJO1krY671o0zbGRzx-gXPtVY,7534
|
29
29
|
libinephany/pydantic_models/states/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
|
-
libinephany/pydantic_models/states/hyperparameter_states.py,sha256=
|
30
|
+
libinephany/pydantic_models/states/hyperparameter_states.py,sha256=JWNSmQmncnQu2GTh0MeT8pvPLxttyrhsKXErucdURqQ,32223
|
31
31
|
libinephany/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
32
|
libinephany/utils/agent_utils.py,sha256=_2w1AY5Y4mQ5hes_Rq014VhZXOtIOn-W92mZgeixv3g,2658
|
33
33
|
libinephany/utils/asyncio_worker.py,sha256=Ew23zKIbG1zwyCudcyiObMrw4G0f3p2QXzZfM4mePqI,2751
|
@@ -50,8 +50,8 @@ libinephany/utils/typing.py,sha256=rGbaPO3MaUndsWiC_wHzReD_TOLYqb43i01pKN-j7Xs,6
|
|
50
50
|
libinephany/web_apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
51
51
|
libinephany/web_apps/error_logger.py,sha256=gAQIaqerqP4ornXZwFF1cghjnd2mMZEt3aVrTuUCr34,16653
|
52
52
|
libinephany/web_apps/web_app_utils.py,sha256=qiq_lasPipgN1RgRudPJc342kYci8O_4RqppxmIX8NY,4095
|
53
|
-
libinephany-0.
|
54
|
-
libinephany-0.
|
55
|
-
libinephany-0.
|
56
|
-
libinephany-0.
|
57
|
-
libinephany-0.
|
53
|
+
libinephany-0.14.0.dist-info/licenses/LICENSE,sha256=pogfDoMBP07ehIOvWymuWIar8pg2YLUhqOHsJQU3wdc,9250
|
54
|
+
libinephany-0.14.0.dist-info/METADATA,sha256=32VAU-sCvWbhgj89cKZLRIWP_P9aa3QtH3jK9DuPnaE,8354
|
55
|
+
libinephany-0.14.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
56
|
+
libinephany-0.14.0.dist-info/top_level.txt,sha256=bYAOXQdJgIoLkO2Ui0kxe7pSYegS_e38u0dMscd7COQ,12
|
57
|
+
libinephany-0.14.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|