Aracılığıyla paylaş


İşlem yönetimini v2'ye yükseltme

İşlem yönetimi, v2 geliştirme platformunda işlevsel olarak değişmeden kalır.

Bu makalede SDK v1 ve SDK v2'deki senaryoların karşılaştırması yer alır.

İşlem örneği oluşturma

  • SDK v1

    import datetime
    import time
    
    from azureml.core.compute import ComputeTarget, ComputeInstance
    from azureml.core.compute_target import ComputeTargetException
    
    # Compute Instances need to have a unique name across the region.
    # Here, we create a unique name with current datetime
    ci_basic_name = "basic-ci" + datetime.datetime.now().strftime("%Y%m%d%H%M")
    
    compute_config = ComputeInstance.provisioning_configuration(
            vm_size='STANDARD_DS3_V2'
        )
        instance = ComputeInstance.create(ws, ci_basic_name , compute_config)
        instance.wait_for_completion(show_output=True)
    
  • SDK v2

    # Compute Instances need to have a unique name across the region.
    # Here, we create a unique name with current datetime
    from azure.ai.ml.entities import ComputeInstance, AmlCompute
    import datetime
    
    ci_basic_name = "basic-ci" + datetime.datetime.now().strftime("%Y%m%d%H%M")
    ci_basic = ComputeInstance(name=ci_basic_name, size="STANDARD_DS3_v2", idle_time_before_shutdown_minutes="30")
    ml_client.begin_create_or_update(ci_basic)
    

İşlem kümesi oluşturma

  • SDK v1

    from azureml.core.compute import ComputeTarget, AmlCompute
    from azureml.core.compute_target import ComputeTargetException
    
    # Choose a name for your CPU cluster
    cpu_cluster_name = "cpucluster"
    compute_config = AmlCompute.provisioning_configuration(vm_size='STANDARD_DS3_V2',
                                                               max_nodes=4)
    cpu_cluster = ComputeTarget.create(ws, cpu_cluster_name, compute_config)
    cpu_cluster.wait_for_completion(show_output=True)
    
  • SDK v2

    from azure.ai.ml.entities import AmlCompute
    cpu_cluster_name = "cpucluster"
    cluster_basic = AmlCompute(
        name=cpu_cluster_name,
        type="amlcompute",
        size="STANDARD_DS3_v2",
        max_instances=4
    )
    ml_client.begin_create_or_update(cluster_basic)
    

SDK v1 ve SDK v2'deki temel işlevlerin eşlemesi

SDK v1'deki işlevsellik SDK v2'de kaba eşleme
SDK v1'de Yöntem/API (başvuru belgelerinin bağlantılarını kullanın) SDK v2'de Yöntem/API (başvuru belgeleri bağlantılarını kullanın)

Sonraki adımlar