Skip to content

Commit 01158b6

Browse files
authored
Merge pull request #79807 from PeterCLu/plu-amls-tf-keras-patch
AMLs TensorFlow Keras Estimators patch
2 parents 2b506e6 + 9a7f205 commit 01158b6

File tree

2 files changed

+41
-13
lines changed

2 files changed

+41
-13
lines changed

articles/machine-learning/service/how-to-train-keras.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@ Whether you're developing a Keras model from the ground-up or you're bringing an
2222

2323
## Prerequisites
2424

25-
- An Azure subscription. Try the [free or paid version of Azure Machine Learning service](https://aka.ms/AMLFree) today.
26-
- [Install the Azure Machine Learning SDK for Python](setup-create-workspace.md#sdk)
27-
- [Create a workspace configuration file](setup-create-workspace.md#write-a-configuration-file)
28-
- [Download the sample script files](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-keras) `mnist-keras.py` and `utils.py`
25+
Run this code on either of these environments:
2926

30-
You can also find a completed [Jupyter Notebook version](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-keras/train-hyperparameter-tune-deploy-with-keras.ipynb) of this guide on GitHub samples page. The notebook includes expanded sections covering intelligent hyperparameter tuning, model deployment, and notebook widgets.
27+
- Azure Machine Learning Notebook VM - no downloads or installation necessary
28+
29+
- Complete the [cloud-based notebook quickstart](quickstart-run-cloud-notebook.md) to create a dedicated notebook server pre-loaded with the SDK and the sample repository.
30+
- In the samples folder on the notebook server, find a completed and expanded notebook by navigating to this directory: **how-to-use-azureml > training-with-deep-learning > train-hyperparameter-tune-deploy-with-keras** folder.
31+
32+
- Your own Jupyter Notebook server
33+
34+
- [Install the Azure Machine Learning SDK for Python](setup-create-workspace.md#sdk)
35+
- [Create a workspace configuration file](setup-create-workspace.md#write-a-configuration-file)
36+
- [Download the sample script files](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-keras) `mnist-keras.py` and `utils.py`
37+
38+
You can also find a completed [Jupyter Notebook version](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-keras/train-hyperparameter-tune-deploy-with-keras.ipynb) of this guide on the GitHub samples page. The notebook includes expanded sections covering intelligent hyperparameter tuning, model deployment, and notebook widgets.
3139

3240
## Set up the experiment
3341

@@ -100,12 +108,24 @@ The [datastore](how-to-access-data.md) is a place where data can be stored and a
100108
shutil.copy('./utils.py', script_folder)
101109
```
102110

103-
## Get the default compute target
111+
## Create a compute target
104112

105-
Each workspace comes with two, default compute targets: a gpu-based compute target and a cpu-based compute target. The default compute targets have autoscale set to 0, which means they are not allocated until you use it. WIn this example, use the default GPU compute target.
113+
Create a compute target for your TensorFlow job to run on. In this example, create a GPU-enabled Azure Machine Learning compute cluster.
106114

107115
```Python
108-
compute_target = ws.get_default_compute_target(type="GPU")
116+
cluster_name = "gpucluster"
117+
118+
try:
119+
compute_target = ComputeTarget(workspace=ws, name=cluster_name)
120+
print('Found existing compute target')
121+
except ComputeTargetException:
122+
print('Creating a new compute target...')
123+
compute_config = AmlCompute.provisioning_configuration(vm_size='STANDARD_NC6',
124+
max_nodes=4)
125+
126+
compute_target = ComputeTarget.create(ws, cluster_name, compute_config)
127+
128+
compute_target.wait_for_completion(show_output=True, min_node_count=None, timeout_in_minutes=20)
109129
```
110130

111131
For more information on compute targets, see the [what is a compute target](concept-compute-target.md) article.

articles/machine-learning/service/how-to-train-tensorflow.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@ Whether you're developing a TensorFlow model from the ground-up or you're bringi
2222

2323
## Prerequisites
2424

25-
- An Azure subscription. Try the [free or paid version of Azure Machine Learning service](https://aka.ms/AMLFree) today.
26-
- [Install the Azure Machine Learning SDK for Python](setup-create-workspace.md#sdk)
27-
- [Create a workspace configuration file](setup-create-workspace.md#write-a-configuration-file)
28-
- [Download the sample script files](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-tensorflow) `mnist-tf.py` and `utils.py`
25+
Run this code on either of these environments:
2926

30-
You can also find a completed [Jupyter Notebook version](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-tensorflow/train-hyperparameter-tune-deploy-with-tensorflow.ipynb) of this guide on GitHub samples page. The notebook includes expanded sections covering intelligent hyperparameter tuning, model deployment, and notebook widgets.
27+
- Azure Machine Learning Notebook VM - no downloads or installation necessary
28+
29+
- Complete the [cloud-based notebook quickstart](quickstart-run-cloud-notebook.md) to create a dedicated notebook server pre-loaded with the SDK and the sample repository.
30+
- In the samples folder on the notebook server, find a completed and expanded notebook by navigating to this directory: **how-to-use-azureml > training-with-deep-learning > train-hyperparameter-tune-deploy-with-tensorflow** folder.
31+
32+
- Your own Jupyter Notebook server
33+
34+
- [Install the Azure Machine Learning SDK for Python](setup-create-workspace.md#sdk)
35+
- [Create a workspace configuration file](setup-create-workspace.md#write-a-configuration-file)
36+
- [Download the sample script files](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-tensorflow) `mnist-tf.py` and `utils.py`
37+
38+
You can also find a completed [Jupyter Notebook version](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/training-with-deep-learning/train-hyperparameter-tune-deploy-with-tensorflow/train-hyperparameter-tune-deploy-with-tensorflow.ipynb) of this guide on the GitHub samples page. The notebook includes expanded sections covering intelligent hyperparameter tuning, model deployment, and notebook widgets.
3139

3240
## Set up the experiment
3341

0 commit comments

Comments
 (0)