Skip to content

Commit 994f623

Browse files
authored
Dont run samples for any checkin (Azure#1799)
* Dont run samples for any checkin * Reformat with black
1 parent ed004e5 commit 994f623

File tree

5 files changed

+58
-43
lines changed

5 files changed

+58
-43
lines changed

.github/workflows/sdk-endpoints-online-kubernetes-kubernetes-online-endpoints-safe-rollout.yml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
branches:
1313
- main
1414
paths:
15-
- sdk/python/**
1615
- .github/workflows/sdk-endpoints-online-kubernetes-kubernetes-online-endpoints-safe-rollout.yml
1716
- sdk/python/dev-requirements.txt
1817
- .github/kubernetes-compute/tool.sh

.github/workflows/sdk-endpoints-online-kubernetes-kubernetes-online-endpoints-simple-deployment.yml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
branches:
1313
- main
1414
paths:
15-
- sdk/python/**
1615
- .github/workflows/sdk-endpoints-online-kubernetes-kubernetes-online-endpoints-simple-deployment.yml
1716
- sdk/python/dev-requirements.txt
1817
- .github/kubernetes-compute/tool.sh

sdk/python/resources/connections/connections.ipynb

+7-15
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,14 @@
111111
"acr_password = os.environ[\"ACR_PASSWORD\"]\n",
112112
"\n",
113113
"credentials = UsernamePasswordConfiguration(\n",
114-
" username=acr_username,\n",
115-
" password=acr_password\n",
114+
" username=acr_username, password=acr_password\n",
116115
")\n",
117116
"\n",
118117
"ws_connection = WorkspaceConnection(\n",
119118
" name=\"<connection_name>\",\n",
120-
" target=\"<acr_url>\", # testacr.azurecr.io,\n",
119+
" target=\"<acr_url>\", # testacr.azurecr.io,\n",
121120
" type=\"container_registry\",\n",
122-
" credentials=credentials\n",
121+
" credentials=credentials,\n",
123122
")\n",
124123
"\n",
125124
"ml_client.connections.create_or_update(ws_connection)"
@@ -147,15 +146,10 @@
147146
"# fetching secrets from env var to secure access, these secrets can be set outside or source code\n",
148147
"git_pat = os.environ[\"GIT_PAT\"]\n",
149148
"\n",
150-
"credentials = PatTokenConfiguration(\n",
151-
" pat=git_pat\n",
152-
")\n",
149+
"credentials = PatTokenConfiguration(pat=git_pat)\n",
153150
"\n",
154151
"ws_connection = WorkspaceConnection(\n",
155-
" name=\"<connection_name>\",\n",
156-
" target=\"<git_url>\",\n",
157-
" type=\"git\",\n",
158-
" credentials=credentials\n",
152+
" name=\"<connection_name>\", target=\"<git_url>\", type=\"git\", credentials=credentials\n",
159153
")\n",
160154
"\n",
161155
"ml_client.connections.create_or_update(ws_connection)"
@@ -183,15 +177,13 @@
183177
"# fetching secrets from env var to secure access, these secrets can be set outside or source code\n",
184178
"python_feed_sas = os.environ[\"PYTHON_FEED_SAS\"]\n",
185179
"\n",
186-
"credentials = SasTokenConfiguration(\n",
187-
" pat=python_feed_sas\n",
188-
")\n",
180+
"credentials = SasTokenConfiguration(pat=python_feed_sas)\n",
189181
"\n",
190182
"ws_connection = WorkspaceConnection(\n",
191183
" name=\"<connection_name>\",\n",
192184
" target=\"<python_feed_url>\",\n",
193185
" type=\"python_feed\",\n",
194-
" credentials=credentials\n",
186+
" credentials=credentials,\n",
195187
")\n",
196188
"\n",
197189
"ml_client.connections.create_or_update(ws_connection)"

v1/python-sdk/tutorials/automl-with-azureml/automl-nlp-ner/automl-nlp-ner.ipynb

+1-3
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,7 @@
448448
"metadata": {},
449449
"outputs": [],
450450
"source": [
451-
"print(\n",
452-
" named_entity_recognition_report(output_prediction_file, data_dir + \"/test.txt\")\n",
453-
")"
451+
"print(named_entity_recognition_report(output_prediction_file, data_dir + \"/test.txt\"))"
454452
]
455453
}
456454
],

v1/python-sdk/tutorials/automl-with-azureml/automl-nlp-ner/utils.py

+50-23
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
from seqeval.metrics.sequence_labeling import precision_recall_fscore_support
33
from azureml.automl.core.shared.constants import Metric
44

5-
def named_entity_recognition_report(predictions_file, test_data_file, use_str = True):
6-
5+
6+
def named_entity_recognition_report(predictions_file, test_data_file, use_str=True):
7+
78
# getting the predicted and true labels
89
def get_labels_from_file(file):
9-
10+
1011
labels = []
1112
current_labels = []
1213
with open(file) as opened:
@@ -22,39 +23,65 @@ def get_labels_from_file(file):
2223

2324
labels.append(current_labels)
2425
return labels
25-
26+
2627
prediction_labels = get_labels_from_file(predictions_file)
2728
true_labels = get_labels_from_file(test_data_file)
28-
29+
2930
# accuracy
3031
accuracy = accuracy_score(y_true=true_labels, y_pred=prediction_labels)
3132
# micro averages
3233
precision_micro, recall_micro, f1_micro, _ = precision_recall_fscore_support(
33-
y_true=true_labels, y_pred=prediction_labels, average='micro'
34+
y_true=true_labels, y_pred=prediction_labels, average="micro"
3435
)
3536
# macro averages
3637
precision_macro, recall_macro, f1_macro, _ = precision_recall_fscore_support(
37-
y_true=true_labels, y_pred=prediction_labels, average='macro'
38+
y_true=true_labels, y_pred=prediction_labels, average="macro"
3839
)
3940
# weighted averages
40-
precision_weighted, recall_weighted, f1_weighted, _ = precision_recall_fscore_support(
41-
y_true=true_labels, y_pred=prediction_labels, average='weighted'
41+
(
42+
precision_weighted,
43+
recall_weighted,
44+
f1_weighted,
45+
_,
46+
) = precision_recall_fscore_support(
47+
y_true=true_labels, y_pred=prediction_labels, average="weighted"
4248
)
43-
49+
4450
if use_str:
4551
results = Metric.Accuracy + "\t" + "{:.3f}".format(accuracy) + "\n"
4652
results += "\t\t" + "F1-score" + "\t" + "Precision" + "\t" + "Recall" + "\n"
47-
results += "micro" + "\t\t" + "{:.3f}".format(f1_micro) + "\t\t" \
48-
+ "{:.3f}".format(precision_micro) + "\t\t" \
49-
+ "{:.3f}".format(recall_micro) + "\n"
50-
results += "macro" + "\t\t" + "{:.3f}".format(f1_macro) + "\t\t" \
51-
+ "{:.3f}".format(precision_macro) + "\t\t" \
52-
+ "{:.3f}".format(recall_macro) + "\n"
53-
results += "weighted" + "\t" + "{:.3f}".format(f1_weighted) + "\t\t" \
54-
+ "{:.3f}".format(precision_weighted) + "\t\t" \
55-
+ "{:.3f}".format(recall_weighted) + "\n"
56-
57-
else:
53+
results += (
54+
"micro"
55+
+ "\t\t"
56+
+ "{:.3f}".format(f1_micro)
57+
+ "\t\t"
58+
+ "{:.3f}".format(precision_micro)
59+
+ "\t\t"
60+
+ "{:.3f}".format(recall_micro)
61+
+ "\n"
62+
)
63+
results += (
64+
"macro"
65+
+ "\t\t"
66+
+ "{:.3f}".format(f1_macro)
67+
+ "\t\t"
68+
+ "{:.3f}".format(precision_macro)
69+
+ "\t\t"
70+
+ "{:.3f}".format(recall_macro)
71+
+ "\n"
72+
)
73+
results += (
74+
"weighted"
75+
+ "\t"
76+
+ "{:.3f}".format(f1_weighted)
77+
+ "\t\t"
78+
+ "{:.3f}".format(precision_weighted)
79+
+ "\t\t"
80+
+ "{:.3f}".format(recall_weighted)
81+
+ "\n"
82+
)
83+
84+
else:
5885
results = dict()
5986
results[Metric.Accuracy] = accuracy
6087
results[Metric.F1Micro] = f1_micro
@@ -66,5 +93,5 @@ def get_labels_from_file(file):
6693
results[Metric.RecallMicro] = recall_micro
6794
results[Metric.RecallMacro] = recall_macro
6895
results[Metric.RecallWeighted] = recall_weighted
69-
70-
return results
96+
97+
return results

0 commit comments

Comments
 (0)