def create_workspace_and_config_file(subscription_id, ws_name, ws_resource_group, ws_location): ws = Workspace.create(subscription_id=subscription_id, name=ws_name, resource_group=ws_resource_group, create_resource_group=True, location=ws_location) ws.write_config()
def create_aml_workspace(cfg): """ Creates the AML workspace if it doesn't exist. If it does exist, return the existing one. input : cfg : AMLConfiguration object containing all creation parameters output : ws : type workspace """ try: log.info('Trying to retrieve config file from local filesystem.') ws = Workspace.from_config() if ws.name == cfg.AMLConfig.workspace: log.info('Workspace found with name: ' + ws.name) log.info(' Azure region: ' + ws.location) log.info(' Subscription id: ' + ws.subscription_id) log.info(' Resource group: ' + ws.resource_group) else: log.error('Workspace found ({}), but not the same as in the JSON config file ({}). Please delete config folder (aml_config) and restart.'.format(ws.name, cfg.AMLConfig.workspace)) exit(-2) except: log.info('Unable to find AML config files in (aml_config) - attempting to Creating them.') try: log.info('Creating the workspace on Azure.') ws = Workspace.create(name = cfg.AMLConfig.workspace, auth = cfg.Credentials, subscription_id = cfg.subscription_id, resource_group = cfg.AMLConfig.resource_group, location = cfg.AMLConfig.location, create_resource_group = True, exist_ok = False) log.info('Workspace created. Saving details to file in (aml_config) to accelerate further launches.') ws.get_details() ws.write_config() except Exception as exc: log.error('Unable to create the workspace on Azure. Error Message : ' + str(exc)) exit(-2) return ws
def WSCreate(): subscription_id = request.json['subscription_id'] resource_group = request.json['resource_group'] workspace_name = request.json['workspace_name'] location = request.json['location'] ##Existing \ new workspace try: ws = Workspace(subscription_id=subscription_id, resource_group=resource_group, workspace_name=workspace_name) print("Found workspace {} at location {}".format(ws.name, ws.location)) print('Found existing Workspace.') return "existing Workspace" except: print('need to create new Workspace.') print('Creating new Workspace.') ws = Workspace.create( name=workspace_name, subscription_id=subscription_id, resource_group=resource_group, #create_resource_group=True, location=location) return "ok"
def exec_WorkspaceSetup(self, Parameters: WorkspaceSetupParameter) -> ExecResult: execResult = False old_stdout = sys.stdout sys.stdout = mystdout = StringIO() try: self.ws = Workspace.create( name=Parameters.WorkspaceName, subscription_id=Parameters.SubscriptionId, resource_group=Parameters.ResourceGroup, exist_ok=True) execResult = True except WorkspaceException as we: print(we.message) except Exception as e: print(e) sys.stdout = old_stdout return ExecResult(execResult, mystdout.getvalue())
def create_workspace(workspace_name, resource_group_name=None, location=None, friendly_name=None, storage_account=None, key_vault=None, app_insights=None, container_registry=None, adb_workspace=None, primary_user_assigned_identity=None, cmk_keyvault=None, resource_cmk_uri=None, hbi_workspace=False, create_resource_group=None, exist_ok=False, sku='basic', tags=None, pe_name=None, pe_vnet_name=None, pe_subnet_name=None, pe_subscription_id=None, pe_resource_group=None, pe_auto_approval=None, user_assigned_identity_for_cmk_encryption=None, system_datastores_auth_mode='accessKey'): from azureml._base_sdk_common.cli_wrapper._common import get_cli_specific_auth, get_default_subscription_id, \ get_resource_group_or_default_name auth = get_cli_specific_auth() default_subscription_id = get_default_subscription_id(auth) # resource group can be None, as we create on user's behalf. resource_group_name = get_resource_group_or_default_name( resource_group_name, auth=auth) private_endpoint_config = None if pe_name is not None: private_endpoint_config = PrivateEndPointConfig( pe_name, pe_vnet_name, pe_subnet_name, pe_subscription_id, pe_resource_group) workspace_object = Workspace.create( workspace_name, auth=auth, subscription_id=default_subscription_id, resource_group=resource_group_name, location=location, create_resource_group=create_resource_group, friendly_name=friendly_name, storage_account=storage_account, key_vault=key_vault, app_insights=app_insights, container_registry=container_registry, adb_workspace=adb_workspace, primary_user_assigned_identity=primary_user_assigned_identity, cmk_keyvault=cmk_keyvault, resource_cmk_uri=resource_cmk_uri, hbi_workspace=hbi_workspace, exist_ok=exist_ok, sku=sku, tags=get_tags_dict(tags), private_endpoint_config=private_endpoint_config, private_endpoint_auto_approval=pe_auto_approval, user_assigned_identity_for_cmk_encryption= user_assigned_identity_for_cmk_encryption, system_datastores_auth_mode=system_datastores_auth_mode) # TODO: Need to add a message that workspace created successfully. return workspace_object._get_create_status_dict()
from azureml.train.automl import AutoMLConfig from azureml.train.automl.run import AutoMLRun from azureml.core import Workspace # ## Create and connect to an Azure Machine Learning Workspace # Run the following cell to create a new Azure Machine Learning **Workspace** and save the configuration to disk (next to the Jupyter notebook). # # **Important Note**: You will be prompted to login in the text that is output below the cell. Be sure to navigate to the URL displayed and enter the code that is provided. Once you have entered the code, return to this notebook and wait for the output to read `Workspace configuration succeeded`. # In[ ]: # By using the exist_ok param, if the worskpace already exists you get a reference to the existing workspace # allowing you to re-run this cell multiple times as desired (which is fairly common in notebooks). ws = Workspace.create(name=workspace_name, subscription_id=subscription_id, resource_group=resource_group, location=workspace_region, exist_ok=True) ws.write_config() print('Workspace configuration succeeded') # ### Create AML Compute Cluster # Now you are ready to create the GPU compute cluster. Run the following cell to create a new compute cluster (or retrieve the existing cluster if it already exists). The code below will create a *GPU based* cluster where each node in the cluster is of the size `Standard_NC12`, and the cluster is restricted to use 1 node. This will take couple of minutes to create. # In[ ]: ### Create AML CPU based Compute Cluster from azureml.core.compute import ComputeTarget, AmlCompute from azureml.core.compute_target import ComputeTargetException
"--model_size", type=str, required=False, help="Size of the model from small, medium, large, xlarge", ) parser.add_argument("--box_iou_thresh", type=float, required=False, help="IoU threshold") # parse arguments args = parser.parse_args() ws = Workspace.create( name=args.workspace_name, subscription_id=args.subscription_id, resource_group=args.resource_group, exist_ok=True, ) experiment = Experiment(ws, name=args.experiment_name) # load the best child automl_image_run = AutoMLRun(experiment=experiment, run_id=args.run_id) best_child_run = automl_image_run.get_best_child() model_type = None if args.task_type == "image-object-detection": if args.model_name.startswith("yolo"): # yolo settings model_settings = { "img_size": args.img_size, "model_size": args.model_size,
SUBSCRIPTION_ID = '<azure-subscription-id>' # TODO RESOURCE_GROUP = 'azure-automl-srvless-rg' WORKSPACE_NAME = 'azure-automl-srvless-aml-ws' WORKSPACE_REGION = 'eastus' try: ws = Workspace.from_config() print( 'Workspace configuration succeeded. Skipping the workspace creation steps.' ) except: print('Workspace not accessible. Creating a new workspace.') ws = Workspace.create(name=WORKSPACE_NAME, subscription_id=SUBSCRIPTION_ID, resource_group=RESOURCE_GROUP, location=WORKSPACE_REGION, create_resource_group=True, exist_ok=True) ws.write_config() #%% # Split the data into training and test sets by using the # train_test_split function in the scikit-learn library. from sklearn.model_selection import train_test_split y_df = final_df.pop("totalAmount") x_df = final_df x_train, x_test, y_train, y_test = train_test_split(x_df, y_df, test_size=0.2,