0

我是云功能和 AI Platform Pipeline 的新手。

我将自定义模型存储在 GCS 中,并使用脚本 training.sh 从笔记本电脑运行

training.sh 在哪里

gcloud ai-platform jobs submit training model_training_$now \
--scale-tier basic \
--packages gs://my_project_bucket/my_package_model-0.1.2.tar.gz \
--module-name model.train_pipeline \
--job-dir=gs://my_project_bucket/trained_model \
--region europe-west1 \
--runtime-version=2.5 \
--python-version=3.7 \
-- \
--user_first_arg=first_arg_value --user_second_arg=second_arg_value

每次在 input_data 存储桶中上传新文件时,我都会尝试自动进行培训。我正在使用云功能来做到这一点。但是,我不清楚如何使用 Kuberflow 来运行 training.sh 文件。

我正在使用本教程

https://cloud.google.com/blog/products/ai-machine-learning/using-remote-and-event-triggered-ai-platform-pipelines

和它的笔记本

https://github.com/amygdala/code-snippets/blob/master/ml/notebook_examples/functions/hosted_kfp_gcf.ipynb

在这里,他通过创建容器定义了一个顺序管道。

def sequential_pipeline(filename='gs://ml-pipeline-playground/shakespeare1.txt'):
   """A pipeline with two sequential steps."""
   op1 = dsl.ContainerOp(
       name='filechange',
       image='library/bash:4.4.23',
       command=['sh', '-c'],
       arguments=['echo "%s" > /tmp/results.txt' % filename],
       file_outputs={'newfile': '/tmp/results.txt'})
   op2 = dsl.ContainerOp(
       name='echo',
       image='library/bash:4.4.23',
       command=['sh', '-c'],
       arguments=['echo "%s"' % op1.outputs['newfile']]
       ) 

我看不到如何定义类似的函数来运行我的 training.sh。我需要将我的模型包 my_package_model-0.1.2.tar.gz 容器化吗?

有人熟悉这种类型的自动化吗?

4

0 回答 0