Skip to content

Commit

Permalink
modify the set of metrics format
Browse files Browse the repository at this point in the history
Signed-off-by: helenxie-bit <[email protected]>
  • Loading branch information
helenxie-bit committed Aug 21, 2024
1 parent 160065a commit 48a3ee0
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions sdk/python/v1beta1/kubeflow/katib/api/katib_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,22 +422,10 @@ class name in this argument.
)

# Add metrics collector to the Katib Experiment.
# Up to now, we only support parameter `kind`, of which default value is
# `StdOut`, to specify the kind of metrics collector.
# Up to now, we only support parameter `kind`, of which default value
# is `StdOut`, to specify the kind of metrics collector.
experiment.spec.metrics_collector_spec = models.V1beta1MetricsCollectorSpec(
collector=models.V1beta1CollectorSpec(
kind=metrics_collector_config["kind"]
),
source=models.V1beta1SourceSpec(
filter=models.V1beta1FilterSpec(
metrics_format=[
# For example: train_loss=0.846
r"([\w|-]+)\s*=\s*([+-]?\d*(\.\d+)?([Ee][+-]?\d+)?)",
# For example: 'train_loss':0.846
r"'([\w|-]+)'\s*:\s*([+-]?\d*(\.\d+)?([Ee][+-]?\d+)?)",
]
)
),
collector=models.V1beta1CollectorSpec(kind=metrics_collector_config["kind"])
)

# Create Container and Pod specifications.
Expand Down Expand Up @@ -515,10 +503,20 @@ class name in this argument.
)
except ImportError:
raise ImportError(
"Tune API dependencies not installed. "
"LLM dependencies for Tune API are not installed. "
+ "Run: pip install -U 'kubeflow-katib[huggingface]' "
)

# Add metrics format for the metrics collector.
experiment.spec.metrics_collector_spec.source=models.V1beta1SourceSpec(
filter=models.V1beta1FilterSpec(
metrics_format=[
# For example: 'train_loss':0.846
r"'([\w|-]+)'\s*:\s*([+-]?\d*(\.\d+)?([Ee][+-]?\d+)?)",
]
)
)

# Create PVC for the Storage Initializer.
# TODO (helenxie-bit): PVC Creation should be part of Katib Controller.
try:
Expand Down

0 comments on commit 48a3ee0

Please sign in to comment.