CodeConfiguration 類別

評分作業的程式碼組態。

繼承
azure.ai.ml.entities._mixins.DictMixin
CodeConfiguration

建構函式

CodeConfiguration(code: str | PathLike | None = None, scoring_script: str | PathLike | None = None)

參數

名稱 Description
code
Optional[Union[<xref:azure.ai.ml.entities.Code>, str]]

包含評分腳本的程式碼目錄。 程式碼可以是 Code 物件、現有程式碼資產的 ARM 資源識別碼、本機路徑或 「HTTP:」、「HTTPs:」或指向遠端位置的 「azureml:」 URL。

預設值: None
scoring_script

相對於程式碼目錄的評分腳本檔案路徑。

預設值: None

範例

建立 BatchDeployment 的 CodeConfiguration。


   from azure.ai.ml.entities import BatchDeployment, CodeConfiguration

   deployment = BatchDeployment(
       name="non-mlflow-deployment",
       description="this is a sample non-mlflow deployment",
       endpoint_name="my-batch-endpoint",
       model=model,
       code_configuration=CodeConfiguration(
           code="configs/deployments/model-2/onlinescoring", scoring_script="score1.py"
       ),
       environment="env",
       compute="cpu-cluster",
       instance_count=2,
       max_concurrency_per_instance=2,
       mini_batch_size=10,
       output_file_name="predictions.csv",
   )

方法

get
has_key
items
keys
update
values

get

get(key: Any, default: Any | None = None) -> Any

參數

名稱 Description
key
必要
default
預設值: None

has_key

has_key(k: Any) -> bool

參數

名稱 Description
k
必要

items

items() -> list

keys

keys() -> list

update

update(*args: Any, **kwargs: Any) -> None

values

values() -> list

屬性

scoring_script

相對於程式碼目錄的評分腳本檔案路徑。

傳回

類型 Description
str