Skip to content

Commit

Permalink
Create MLConfig from passed argument (#2532)
Browse files Browse the repository at this point in the history
* Create MLConfig from passed argument

* use default cred

---------

Co-authored-by: grajguru <[email protected]>
  • Loading branch information
gauravrajguru and grajguru authored Aug 4, 2023
1 parent 1384c93 commit ea919fd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import urllib
from zipfile import ZipFile

from azure.identity import InteractiveBrowserCredential
from azure.identity import DefaultAzureCredential
from azure.ai.ml import MLClient
from azure.ai.ml.entities import Data
from azure.ai.ml.constants import AssetTypes
Expand Down Expand Up @@ -150,16 +150,12 @@ def read_image(image_path):
args, unknown = parser.parse_known_args()
args_dict = vars(args)

credential = InteractiveBrowserCredential()
credential = DefaultAzureCredential()
ml_client = None
try:
ml_client = MLClient.from_config(credential)
except Exception as ex:
# Enter details of your AML workspace
subscription_id = args.subscription
resource_group = args.group
workspace = args.workspace
ml_client = MLClient(credential, subscription_id, resource_group, workspace)
subscription_id = args.subscription
resource_group = args.group
workspace = args.workspace
ml_client = MLClient(credential, subscription_id, resource_group, workspace)

upload_data_and_create_jsonl_mltable_files(ml_client=ml_client, dataset_parent_dir=args.data_path)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import urllib
from zipfile import ZipFile

from azure.identity import InteractiveBrowserCredential
from azure.identity import DefaultAzureCredential
from azure.ai.ml import MLClient
from azure.ai.ml.entities import Data
from azure.ai.ml.constants import AssetTypes
Expand Down Expand Up @@ -155,16 +155,12 @@ def read_image(image_path):
args, unknown = parser.parse_known_args()
args_dict = vars(args)

credential = InteractiveBrowserCredential()
credential = DefaultAzureCredential()
ml_client = None
try:
ml_client = MLClient.from_config(credential)
except Exception as ex:
# Enter details of your AML workspace
subscription_id = args.subscription
resource_group = args.group
workspace = args.workspace
ml_client = MLClient(credential, subscription_id, resource_group, workspace)
subscription_id = args.subscription
resource_group = args.group
workspace = args.workspace
ml_client = MLClient(credential, subscription_id, resource_group, workspace)

upload_data_and_create_jsonl_mltable_files(ml_client=ml_client, dataset_parent_dir=args.data_path)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from zipfile import ZipFile

from azure.identity import InteractiveBrowserCredential
from azure.identity import DefaultAzureCredential
from azure.ai.ml import MLClient
from azure.ai.ml.entities import Data
from azure.ai.ml.constants import AssetTypes
Expand Down Expand Up @@ -258,16 +258,12 @@ def read_image(image_path: str):
args, unknown = parser.parse_known_args()
args_dict = vars(args)

credential = InteractiveBrowserCredential()
credential = DefaultAzureCredential()
ml_client = None
try:
ml_client = MLClient.from_config(credential)
except Exception as ex:
# Enter details of your AML workspace
subscription_id = args.subscription
resource_group = args.group
workspace = args.workspace
ml_client = MLClient(credential, subscription_id, resource_group, workspace)
subscription_id = args.subscription
resource_group = args.group
workspace = args.workspace
ml_client = MLClient(credential, subscription_id, resource_group, workspace)

upload_data_and_create_jsonl_mltable_files(
ml_client=ml_client, dataset_parent_dir=args.data_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from zipfile import ZipFile

from azure.identity import InteractiveBrowserCredential
from azure.identity import DefaultAzureCredential
from azure.ai.ml import MLClient
from azure.ai.ml.entities import Data
from azure.ai.ml.constants import AssetTypes
Expand Down Expand Up @@ -223,16 +223,12 @@ def read_image(image_path: str):
args, unknown = parser.parse_known_args()
args_dict = vars(args)

credential = InteractiveBrowserCredential()
credential = DefaultAzureCredential()
ml_client = None
try:
ml_client = MLClient.from_config(credential)
except Exception as ex:
# Enter details of your AML workspace
subscription_id = args.subscription
resource_group = args.group
workspace = args.workspace
ml_client = MLClient(credential, subscription_id, resource_group, workspace)
subscription_id = args.subscription
resource_group = args.group
workspace = args.workspace
ml_client = MLClient(credential, subscription_id, resource_group, workspace)

upload_data_and_create_jsonl_mltable_files(
ml_client=ml_client, dataset_parent_dir=args.data_path
Expand Down

0 comments on commit ea919fd

Please sign in to comment.