0

We are using kpf v2 in Google Clouds Vertex AI and want to log metrics from a component built by a yaml specification.

We can only make this work from a Python function based component were we can call the mlpipeline-metrics (of type Output[Metrics]) with log_metrics(..) directly.

The docs at https://www.kubeflow.org/docs/components/pipelines/sdk/pipelines-metrics/ says that you can write your metrics in json from inside the container to an OutputPath named MLPipeline Metrics. But this doesn't work in Vertex AI since the metr8cs does not show up in the console.

Our component is set up like this:

name: a component

outputs:
- {name: MLPipeline Metrics, type: Metrics}

implementation:
  container:
    image: eu.gcr.io/project/knark/base:latest
    command: [python3, -m, module.foo,
              --metrics, {outputPath: MLPipeline Metrics}

With the metrics file being written like this:

parser = ArgumentParser()
parser.add_argument('-m', '--metrics', default='/mlpipeline-metrics.json')
opts = parser.parse_args()

metrics = {'cluster-entropy': .5, 'inertia': 100.}

with open(metrics_path, 'w') as f:
    json.dump({'metrics': [{'name': m, 'value': v, 'format': 'RAW'} for m, v in metrics.items()]}, f)

We also tried setting

    fileOutputs:
      mlpipeline-metrics: /mlpipeline-metrics.json

in the component which seems to be the way to do it earlier but this doesn't appear to work either.

Are there any details I'm missing in writing out the metrics or does this not work at all or is it unsupported in Vertex AI?

sniggatooth
  • 131
  • 3
  • AFAIK there is no way to check or monitor these metrics from Vertex, the monitoring metrics for vertex are a bit limited at the time I suppose it would be worth rising FR, this should be done [via Send Feedback in the documentation](https://cloud.google.com/vertex-ai/docs/support/getting-support#file_bugs_or_feature_requests) – vitooh Oct 08 '21 at 13:42

1 Answers1

0

A way that is explained in the Docs, neh. But in a issue of the Kubeflow Pipelines Repo was given a solution, he modify the .yaml a bit and put a small modification in the component code by calling the Executor class.

https://github.com/kubeflow/pipelines/issues/6116#issuecomment-1059174206

I added a few things to it and put it in a repo for a deployment using only containers and also adding the example with input artifacts and input parameters

https://github.com/juansebashr/VertexPipelinesCICD