libinephany 0.13.8__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.
@@ -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(parameter_group_name=parameter_group_name, **hyperparameters)
386
-
387
- def get_current_internal_values(self, skip_hparams: list[str] | None = None) -> dict[str, float | int | None]:
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libinephany
3
- Version: 0.13.8
3
+ Version: 0.14.0
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
@@ -16,7 +16,7 @@ libinephany/observations/post_processors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
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=48pooGTxfg7Ol_mA770h1-x79Qgel-jxvlj5BRjcf1Q,13537
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=7rEC9w8l-V-3hySUZUlHF-Pv0WPZaAwPCsgmlJsPalc,1524
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=q2MUEb7jywa6SiGy0zF2if250AkKhUZeci2KfJJhQoA,31334
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.13.8.dist-info/licenses/LICENSE,sha256=pogfDoMBP07ehIOvWymuWIar8pg2YLUhqOHsJQU3wdc,9250
54
- libinephany-0.13.8.dist-info/METADATA,sha256=cW9naaWcJk4FzvxOuhax_JgNqNInbOZKz-ffZQKRxuk,8354
55
- libinephany-0.13.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
56
- libinephany-0.13.8.dist-info/top_level.txt,sha256=bYAOXQdJgIoLkO2Ui0kxe7pSYegS_e38u0dMscd7COQ,12
57
- libinephany-0.13.8.dist-info/RECORD,,
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,,