メインコンテンツまでスキップ
バージョン: v2509

integration.kubernetes.annotation_based_tuning

Annotation-based tuning converters for PyTorchJob.

annotation_job_converter

def annotation_job_converter(trial: Trial, job: PyTorchJob) -> PyTorchJob

Convert job based on annotation configuration.

This function reads the zenith-tune/optimization-config annotation and applies the hyperparameter values suggested by the trial.

Arguments:

  • trial - Optuna trial object
  • job - Original PyTorchJob

Returns:

Modified PyTorchJob with trial parameters applied

Raises:

  • ValueError - If tuning config is invalid or missing required fields

annotation_value_extractor

def annotation_value_extractor(log_path: str, job: PyTorchJob) -> float

Extract objective value from logs based on annotation configuration.

This function reads the zenith-tune/optimization-config annotation and extracts the objective value using the specified regex pattern.

Arguments:

  • log_path - Path to the log file
  • job - PyTorchJob object

Returns:

Extracted objective value

Raises:

  • ValueError - If no objective configuration found or value cannot be extracted