nat.profiler.parameter_optimization.optimizer_callbacks#
Attributes#
Classes#
Base class for protocol classes. |
|
Module Contents#
- logger#
- class TrialResult#
- class OptimizerCallback#
Bases:
ProtocolBase class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto[T](Protocol): def meth(self) -> T: ...
- pre_create_experiment(
- dataset_items: list[nat.eval.evaluator.evaluator_model.EvalInputItem],
- on_trial_end(result: TrialResult) None#
- on_study_end(*, best_trial: TrialResult, total_trials: int) None#
- class OptimizerCallbackManager#
- _callbacks: list[OptimizerCallback] = []#
- register(callback: OptimizerCallback) None#
- pre_create_experiment(
- dataset_items: list[nat.eval.evaluator.evaluator_model.EvalInputItem],
- on_trial_end(result: TrialResult) None#
- get_trial_project_name(trial_number: int) str | None#
Get a trial-specific OTEL project name from the first callback that supports it.
- on_study_end(*, best_trial: TrialResult, total_trials: int) None#