Untitled
unknown
python
2 years ago
1.4 kB
2
Indexable
from azure.ai.ml.entities import AmlCompute # Name assigned to the compute cluster cpu_compute_target = "cpu-cluster" try: # let's see if the compute target already exists cpu_cluster = ml_client.compute.get(cpu_compute_target) print( f"You already have a cluster named {cpu_compute_target}, we'll reuse it as is." ) except Exception: print("Creating a new cpu compute target...") # Let's create the Azure ML compute object with the intended parameters cpu_cluster = AmlCompute( name=cpu_compute_target, # Azure ML Compute is the on-demand VM service type="amlcompute", # VM Family size="STANDARD_DS3_V2", # Minimum running nodes when there is no job running min_instances=0, # Nodes in cluster max_instances=4, # How many seconds will the node running after the job termination idle_time_before_scale_down=180, # Dedicated or LowPriority. The latter is cheaper but there is a chance of job termination tier="Dedicated", ) # Now, we pass the object to MLClient's create_or_update method cpu_cluster = ml_client.compute.begin_create_or_update(cpu_cluster) print( f"AMLCompute with name {cpu_cluster.name} is created, the compute size is {cpu_cluster.size}" )
Editor is loading...