【问题标题】:Syntax Error When Running `gcloud ml-engine` commands in Google Datalab在 Google Datalab 中运行“gcloud ml-engine”命令时出现语法错误
【发布时间】:2018-07-20 12:59:10
【问题描述】:

我正在尝试使用 DataLab 将模型部署到 Google ML Engine。该代码在我的实时项目数据实验室中有效,但在我的暂存数据实验室中出现语法错误。我认为这可能是由于 gcloud 的版本不同,所以我运行了更新,但仍然遇到相同的语法错误。我该如何解决这个问题?

代码:

MODEL_NAME="waittimes_model_03"
MODEL_VERSION="ml_on_gcp_waittimes_06"
gcloud ml-engine models create ${MODEL_NAME} --regions us-central1
gcloud ml-engine versions create ${MODEL_VERSION} --model ${MODEL_NAME} --origin waitestimates/export/exporter/1532010994 --staging-bucket ${BUCKET}  --runtime-version 1.6

错误:

File "<ipython-input-4-104542ff058c>", line 8
    gcloud ml-engine models create ${MODEL_NAME} --regions us-central1
            ^
SyntaxError: invalid syntax

【问题讨论】:

    标签: google-cloud-platform google-cloud-ml google-cloud-datalab


    【解决方案1】:

    ! 前缀添加到您的命令中,例如,

    !gcloud ml-engine models create ${MODEL_NAME} --regions us-central1
    

    【讨论】:

    • 谢谢!这行得通。我还注意到,使用单个 % 而不是我使用的 %% 也有效。
    猜你喜欢
    • 2019-02-16
    • 2017-10-02
    • 2018-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多