-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(all): update for course september 2024 (#37)
- Loading branch information
1 parent
f4b6cb0
commit 7b782c6
Showing
12 changed files
with
208 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import argparse | ||
|
||
from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential | ||
|
||
from azure.ai.ml import MLClient | ||
|
||
|
||
parser = argparse.ArgumentParser("train") | ||
parser.add_argument("--subscription_id", type=str) | ||
parser.add_argument("--resource_group_name", type=str) | ||
parser.add_argument("--workspace_name", type=str) | ||
parser.add_argument("--location", type=str) | ||
parser.add_argument("--version", type=str, default="1") | ||
parser.add_argument("--download_path", type=str, default="./") | ||
|
||
args = parser.parse_args() | ||
subscription_id = args.subscription_id | ||
resource_group_name = args.resource_group_name | ||
workspace_name = args.workspace_name | ||
location = args.location | ||
version = args.version | ||
download_path = args.download_path | ||
|
||
try: | ||
credential = DefaultAzureCredential() | ||
# Check if given credential can get token successfully. | ||
credential.get_token("https://management.azure.com/.default") | ||
except Exception as ex: | ||
print(ex) | ||
# Fall back to InteractiveBrowserCredential in case DefaultAzureCredential not work | ||
credential = InteractiveBrowserCredential() | ||
|
||
|
||
# Get a handle to workspace | ||
ml_client = MLClient( | ||
credential=credential, | ||
subscription_id=subscription_id, | ||
resource_group_name=resource_group_name, | ||
workspace_name=workspace_name, | ||
) | ||
|
||
model_name = 'cats-dogs-others' | ||
|
||
ml_client.models.download(name=model_name, version=version, download_path=download_path) |
Oops, something went wrong.