This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
googlecloud [2017/10/19 03:44] humphrey |
googlecloud [2021/06/30 23:42] (current) |
||
---|---|---|---|
Line 7: | Line 7: | ||
reference: https://cloud.google.com/sdk/downloads | reference: https://cloud.google.com/sdk/downloads | ||
- | 2. Use the following code to set user account, set region of computation unit. | + | 2. Use the following code to setup user account, including setting region of computation unit. |
<code> gcloud init </code> | <code> gcloud init </code> | ||
+ | ---- | ||
==== Setup google cloud storage device ==== | ==== Setup google cloud storage device ==== | ||
3. On the web api (link: https://console.cloud.google.com), click on the drop down manual on the top left hand corner -> click on storage -> click on browse, and create a new storage bucket if there hasn't been one. Let's call it byu_tf_ml in this example. | 3. On the web api (link: https://console.cloud.google.com), click on the drop down manual on the top left hand corner -> click on storage -> click on browse, and create a new storage bucket if there hasn't been one. Let's call it byu_tf_ml in this example. | ||
+ | ---- | ||
==== Submit a learning job to google cloud ==== | ==== Submit a learning job to google cloud ==== | ||
Line 26: | Line 26: | ||
--module-name [scource_dir.main_script] | --module-name [scource_dir.main_script] | ||
--staging-bucket gs://[save_to_directory] | --staging-bucket gs://[save_to_directory] | ||
- | --scale-tier BASIC | + | --scale-tier BASIC_GPU |
</code> | </code> | ||
Line 33: | Line 33: | ||
The command "gcloud ml-engine jobs submit training" is a google cloud version to package up our python machine learning job, uploading that to the cloud platform and then run it on some cloud machines. There four fields are required: | The command "gcloud ml-engine jobs submit training" is a google cloud version to package up our python machine learning job, uploading that to the cloud platform and then run it on some cloud machines. There four fields are required: | ||
- | a. job: in our example, the value is [job_id] in the example, it's the job id showing up in the web api after submitting the job. | + | a. job: In our example, the value is [job_id] in the example, it's the job id showing up in the web api after submitting the job. |
| | ||
- | b. package-path: the local machine directory which contains the python source code. | + | b. package-path: The local machine directory which contains the python source code. |
| | ||
- | c. module-name: the main python script. | + | c. module-name: The main python script. |
| | ||
- | d. staging-bucket: the place on google cloud in which the machine learning source code is stored. | + | d. staging-bucket: The place on google cloud in which the machine learning source code is stored. |
and these are optional: | and these are optional: | ||
- | e. scale-tier: this is optional, but allow a fine control on how much computation power we want to use with the project. | + | e. scale-tier: There are BASIC, BASIC_GPU, PREMIUM_1, STANDARD_1, CUSTOM, five different tiers, standing for different level of resources to be used. |
- | f. package-path: the path where packages you imported into the project but not listed here: https://cloud.google.com/ml-engine/docs/concepts/runtime-version-list | + | f. packages: The path where packages you imported into the project but not listed here: https://cloud.google.com/ml-engine/docs/concepts/runtime-version-list |
+ | ---- | ||
===Hints:=== | ===Hints:=== | ||
Line 60: | Line 60: | ||
return dic | return dic | ||
</code> | </code> | ||
+ | |||
+ | 3. You need a <code>__init__.py</code> file in your source code directory in order to make it work. You can keep it as an empty file. | ||
---- | ---- | ||
Line 73: | Line 75: | ||
4. To open a new browser window, select Preview on port 8080 from the Web preview menu in the top-right corner of the Cloud Shell toolbar. | 4. To open a new browser window, select Preview on port 8080 from the Web preview menu in the top-right corner of the Cloud Shell toolbar. | ||
+ | ---- | ||
==== Related resources ==== | ==== Related resources ==== | ||
1. If you want to reuse the trained weights of of the model, include the savedmodel function in the application. | 1. If you want to reuse the trained weights of of the model, include the savedmodel function in the application. |