簡體   English   中英

Vertex AI 自定義容器訓練作業 python SDK - google.api_core.exceptions.FailedPrecondition: 400 '

[英]Vertex AI Custom Container Training Job python SDK - google.api_core.exceptions.FailedPrecondition: 400 '

我已經構建了一個自定義容器,它使用我在頂點上的托管數據集來運行我的訓練代碼,當我在 Vertex AI 網站界面上創建訓練作業時它成功運行。

但現在我正在嘗試使用 python 腳本創建訓練作業

class google.cloud.aiplatform.CustomContainerTrainingJob

我加載了我在頂點 AI 上的托管數據集

dataset = aiplatform.ImageDataset(dataset_id) if dataset_id else None

但是當我嘗試運行以下代碼時:

model = job.run(
        dataset=dataset,
        model_display_name=model_display_name,
        args=args,
        replica_count=replica_count,
        machine_type=machine_type,
        accelerator_type=accelerator_type,
        accelerator_count=accelerator_count,
        training_fraction_split=training_fraction_split,
        validation_fraction_split=validation_fraction_split,
        test_fraction_split=test_fraction_split,
        sync=sync,
    )

    model.wait()

    print(model.display_name)
    print(model.resource_name)
    print(model.uri)
    return model

我收到以下錯誤:

google.api_core.exceptions.FailedPrecondition: 400 'annotation_schema_uri' should be set in the TrainingPipeline.input_data_config for custom training or hyperparameter tuning with managed dataset.

我覺得有些不對勁,因為當我在網站上創建作業時,我為托管數據集指定了一個導出目錄,但我還沒有找到在哪里執行此操作。

有任何想法嗎?

謝謝

好吧,我在文檔中找到了答案,數據會自動導出到提供的存儲桶中,因此這不是問題。 問題出在錯誤中(顯然)。 要提供一個好的注解 URI,只需在 run() 中添加一個參數就足夠了:

annotation_schema_uri=aiplatform.schema.dataset.annotation.image.classification

image.classification 是我在這里需要的,但如果你進行文本提取,可以用 text.extraction 代替。

這將作為字符串值傳遞以下值,即要求的 gs uri:

gs://google-cloud-aiplatform/schema/dataset/annotation/image_classification_1.0.0.yaml

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM