forked from Azure/azureml-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrain.sh
187 lines (157 loc) · 4.61 KB
/
train.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
## IMPORTANT: this file and accompanying assets are the source for snippets in https://docs.microsoft.com/azure/machine-learning!
## Please reach out to the Azure ML docs & samples team before before editing for the first time.
# <create_computes>
az ml compute create -n cpu-cluster --type AmlCompute --min-instances 0 --max-instances 40
az ml compute create -n gpu-cluster --type AmlCompute --min-instances 0 --max-instances 8 --size Standard_NC12
# </create_computes>
# <hello_world>
az ml job create -f jobs/misc/hello-world.yml --web
# </hello_world>
# <lightgbm_iris>
az ml job create -f jobs/train/lightgbm/iris/job.yml --web
# </lightgbm_iris>
# <lightgbm_iris_output>
run_id=$(az ml job create -f jobs/train/lightgbm/iris/job.yml --query name -o tsv)
# </lightgbm_iris_output>
# <show_job_in_studio>
az ml job show -n $run_id --web
# </show_job_in_studio>
# <stream_job_logs_to_console>
az ml job stream -n $run_id
# </stream_job_logs_to_console>
# <check_job_status>
status=$(az ml job show -n $run_id --query status -o tsv)
echo $status
if [[ $status == "Completed" ]]
then
echo "Job completed"
elif [[ $status == "Failed" ]]
then
echo "Job failed"
exit 1
else
echo "Job status not failed or completed"
exit 2
fi
# </check_job_status>
# <download_outputs>
az ml job download -n $run_id --outputs
# </download_outputs>
# <lightgbm_iris_sweep>
az ml job create -f jobs/train/lightgbm/iris/job-sweep.yml --web
# </lightgbm_iris_sweep>
# <lightgbm_iris_sweep_output>
run_id=$(az ml job create -f jobs/train/lightgbm/iris/job-sweep.yml --query name -o tsv)
# </lightgbm_iris_sweep_output>
# <show_job_in_studio>
az ml job show -n $run_id --web
# </show_job_in_studio>
# <stream_job_logs_to_console>
az ml job stream -n $run_id
# </stream_job_logs_to_console>
# <check_job_status>
status=$(az ml job show -n $run_id --query status -o tsv)
echo $status
if [[ $status == "Completed" ]]
then
echo "Job completed"
elif [[ $status == "Failed" ]]
then
echo "Job failed"
exit 1
else
echo "Job status not failed or completed"
exit 2
fi
# </check_job_status>
# <download_cifar>
wget "https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz"
tar -xvzf cifar-10-python.tar.gz
rm cifar-10-python.tar.gz
mkdir jobs/train/pytorch/cifar-distributed/data
mv cifar-10-batches-py jobs/train/pytorch/cifar-distributed/data
# </download_cifar>
# <pytorch_cifar>
az ml job create -f jobs/train/pytorch/cifar-distributed/job.yml --web
# </pytorch_cifar>
# <pytorch_cifar_output>
run_id=$(az ml job create -f jobs/train/pytorch/cifar-distributed/job.yml --query name -o tsv)
# </pytorch_cifar_output>
# <show_job_in_studio>
az ml job show -n $run_id --web
# </show_job_in_studio>
# <stream_job_logs_to_console>
az ml job stream -n $run_id
# </stream_job_logs_to_console>
# <check_job_status>
status=$(az ml job show -n $run_id --query status -o tsv)
echo $status
if [[ $status == "Completed" ]]
then
echo "Job completed"
elif [[ $status == "Failed" ]]
then
echo "Job failed"
exit 1
else
echo "Job status not failed or completed"
exit 2
fi
# </check_job_status>
# <download_outputs>
az ml job download -n $run_id --outputs
# </download_outputs>
# <tensorflow_mnist>
az ml job create -f jobs/train/tensorflow/mnist-distributed/job.yml --web
# </tensorflow_mnist>
# <tensorflow_mnist_output>
run_id=$(az ml job create -f jobs/train/tensorflow/mnist-distributed/job.yml --query name -o tsv)
# </tensorflow_mnist_output>
# <show_job_in_studio>
az ml job show -n $run_id --web
# </show_job_in_studio>
# <stream_job_logs_to_console>
az ml job stream -n $run_id
# </stream_job_logs_to_console>
# <check_job_status>
status=$(az ml job show -n $run_id --query status -o tsv)
echo $status
if [[ $status == "Completed" ]]
then
echo "Job completed"
elif [[ $status == "Failed" ]]
then
echo "Job failed"
exit 1
else
echo "Job status not failed or completed"
exit 2
fi
# </check_job_status>
# <tensorflow_mnist_horovod>
az ml job create -f jobs/train/tensorflow/mnist-distributed-horovod/job.yml --web
# </tensorflow_mnist_horovod>
# <tensorflow_mnist_horovod_output>
run_id=$(az ml job create -f jobs/train/tensorflow/mnist-distributed-horovod/job.yml --query name -o tsv)
# </tensorflow_mnist_horovod_output>
# <show_job_in_studio>
az ml job show -n $run_id --web
# </show_job_in_studio>
# <stream_job_logs_to_console>
az ml job stream -n $run_id
# </stream_job_logs_to_console>
# <check_job_status>
status=$(az ml job show -n $run_id --query status -o tsv)
echo $status
if [[ $status == "Completed" ]]
then
echo "Job completed"
elif [[ $status == "Failed" ]]
then
echo "Job failed"
exit 1
else
echo "Job status not failed or completed"
exit 2
fi
# </check_job_status>