forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first draft : YAML signing * YAML signing * component ops adding prepare for sign * resolving comments * fixing pylint and black
- Loading branch information
1 parent
cf28b06
commit 596b2c0
Showing
5 changed files
with
208 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import argparse | ||
import os | ||
from datetime import datetime | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--componentB_input", type=str) | ||
parser.add_argument("--componentB_output", type=str) | ||
|
||
print("Hello Python World...\nI'm componentB :-)") | ||
|
||
args = parser.parse_args() | ||
|
||
print("componentB_input path: %s" % args.componentB_input) | ||
print("componentB_output path: %s" % args.componentB_output) | ||
|
||
print("files in input path: ") | ||
arr = os.listdir(args.componentB_input) | ||
print(arr) | ||
|
||
for filename in arr: | ||
print("reading file: %s ..." % filename) | ||
with open(os.path.join(args.componentB_input, filename), "r") as handle: | ||
print(handle.read()) | ||
|
||
cur_time_str = datetime.now().strftime("%b-%d-%Y-%H-%M-%S") | ||
|
||
print("Writing file: %s" % os.path.join(args.componentB_output, "file-" + cur_time_str + ".txt")) | ||
with open(os.path.join(args.componentB_output, "file-" + cur_time_str + ".txt"), "wt") as text_file: | ||
print(f"Logging date time: {cur_time_str}", file=text_file) |
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,20 @@ | ||
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json | ||
code: ../src | ||
command: >- | ||
python main.py train_check --config ${{inputs.data}}/model.yaml --train ${{inputs.data}}/train.csv --sanity-check ${{inputs.data}}/sanity_check.csv --min-accuracy 0.99 --min-precision 0.95 --min-recall 0.95 --model-dir ${{outputs.model}} | ||
inputs: | ||
data: | ||
path: . | ||
mode: download | ||
outputs: | ||
model: | ||
type: uri_folder | ||
environment: | ||
image: mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04 | ||
conda_file: ../src/environment.yml | ||
environment_variables: | ||
AZUREML_COMMON_RUNTIME_USE_SBOM_CAPABILITY: "true" | ||
compute: azureml:gpu-t4-spot-vpn | ||
display_name: Compete | ||
experiment_name: sensei-compete | ||
description: Sensei Compete Model |
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,31 @@ | ||
from azure.identity import ( | ||
DefaultAzureCredential, | ||
AzureCliCredential, | ||
InteractiveBrowserCredential, | ||
) | ||
from azure.ai.ml import MLClient, load_job | ||
from azure.ai.ml.entities import Data, ManagedOnlineEndpoint, Job, CommandComponent | ||
from azure.ai.ml.sweep import SweepJob, GridSamplingAlgorithm, Choice, Objective | ||
from azure.ai.ml import command | ||
from azure.ai.ml.constants import AssetTypes | ||
from azure.ai.ml.entities._load_functions import load_component | ||
|
||
subscription_id = "2d385bf4-0756-4a76-aa95-28bf9ed3b625" | ||
resource_group = "sdkv2-20240925-rg" | ||
workspace_name = "sdkv2-20240925-ws" | ||
|
||
|
||
credential = DefaultAzureCredential() | ||
|
||
print(credential) | ||
ml_client = MLClient( | ||
credential=credential, | ||
subscription_id=subscription_id, | ||
resource_group_name=resource_group, | ||
workspace_name=workspace_name, | ||
) | ||
|
||
component = load_component( | ||
"C:\\Projects\\azure-sdk-for-python\\sdk\\ml\\azure-ai-ml\\azure\\ai\\ml\\YAMLsigning\\sum1.yaml" | ||
) | ||
ml_client.components.prepare_for_sign(component) |