Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

1_International_Google_CoLab_20220307.pptx

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Wird geladen in …3
×

Hier ansehen

1 von 32 Anzeige

Weitere Verwandte Inhalte

Ähnlich wie 1_International_Google_CoLab_20220307.pptx (20)

Anzeige

Aktuellste (20)

1_International_Google_CoLab_20220307.pptx

  1. 1. 國立臺北護理健康大學 NTUNHS Google CoLab Orozco Hsu 2022-03-07 1
  2. 2. About me • Education • NCU (MIS)、NCCU (CS) • Work Experience • Telecom big data Innovation • AI projects • Retail marketing technology • User Group • TW Spark User Group • TW Hadoop User Group • Taiwan Data Engineer Association Director • Research • Big Data/ ML/ AIOT/ AI Columnist 2
  3. 3. Tutorial Content 3 Compare different runtime Flower classification in TPU accelerator Homework Register Google CoLab and let’s started
  4. 4. Code • Download code • https://github.com/orozcohsu/ntunhs_2022_01.git • Folder/file • 20220307_inter_master/run.ipynb 4
  5. 5. Code 5 Click button Open it with Colab Copy it to your google drive Check your google drive
  6. 6. Google CoLab • A jupyter notebook based coding environment for python developer and most popular python packages such like numpy, scikit-learn, tensorflow, keras, pandas and matplotlib… • It also supports hardware accelerate runtime for model building. • GPU (Graphics Processing Unit): Nvidia K80, T4, P4 or P100 • TPU (Tensor Processing Unit): Cloud TPU | Google Cloud • The notebook instance lasts 12 hours running and kernel session for 1 hour. • Pay 9.99 USD/month choosing better plans (CoLab Pro or more) • Plan price: Google Colab 6
  7. 7. Google CoLab • Which One Do You Choose For Training Your Deep Neural Net? 7 Ref: https://www.predictiveanalyticsworld.com/machinelearningtimes/should-you-choose-a-gpu-or-a-tpu-to-train-your-machine-learning-models/10460/ check_colab_gpu_tpu.ipynb
  8. 8. Google CoLab • Get a google account and use google drive service • Launch a CoLab service • Jupyter files repository • Training, test dataset repository • Model files repository • Fast launcher with github repository ipynb file 8
  9. 9. Google CoLab • CoLab limitation • It can give you instances with 12GB of RAM and GPU for 12 hours (Max.) for free use • Save checkpoints during training to avoid time limitation • Not for cryptocurrency mining • Check CoLab FAQ • More details: https://research.google.com/colaboratory/faq.html • TPU price: https://cloud.google.com/tpu/pricing 9
  10. 10. Let’s started 10
  11. 11. Let’s started 11
  12. 12. Let’s started 12
  13. 13. Let’s started 13
  14. 14. Let’s started 14
  15. 15. Let’s started 15
  16. 16. Let’s started • A new web jupyter notebook (has connected) called the runtime. • Using web browser interacting with CoLab (jupyter notebook) called a web session. • Python running through python-kernel (runtime) 16
  17. 17. Let’s started • Set auto-refresh CoLab webpage, avoid to have an idle timeout • Press F12, run above code in console • Don’t close the webpage until you won’t use it anymore 17 function ConnectButton(){ console.log("Connect pushed"); document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click() } setInterval(ConnectButton,60000); After executed, your CoLab webpage will sometime switch back working area automatically in order to avoid the idle timeout Ref: https://research.google.com/colaboratory/faq.html#idle-timeouts
  18. 18. Let’s started 18 File name and configuration Cell (coding area) Session connection Cell control panel Command palette (type logs or scratch or editor) kernel running?
  19. 19. Let’s started • Make a connection 19 Local runtime: https://research.google.com/colaboratory/local-runtimes.html
  20. 20. Let’s started 20 After connecting to a hosted runtime
  21. 21. Let’s started 21 Return runtime resource to google
  22. 22. Let’s started • Runtime (virtual machine) description 22
  23. 23. Let’s started • Using cgroup to control linux resources • Check: https://shekhargulati.co m/2019/01/03/how- docker-uses-cgroups-to- set-resource-limits/ 23
  24. 24. Let’s started • Check runtime disk space and directories 24 Working folder
  25. 25. Let’s started 25
  26. 26. Let’s started 26 Google provides poor TPU to free usage, and more advanced TPU is chargeable.
  27. 27. Let’s started • Mount a resource from google drive and access it (Using pydrive) 27 colab_google_drive.ipynb get folder id
  28. 28. Compare different runtime • GPU vs CPU performance comparison 28 tf2_cpu_gpu_colab.ipynb
  29. 29. Other Topics • Google Cloud Platform (GCP) • https://cloud.google.com/ • CoLab integrates with BigQuery • CoLab integrates with GCS (TPU only) • To more fully use the parallelism, and to avoid bottlenecking on data transfer 29
  30. 30. Other Topics • New features of CoLab • Charts visualization • Downloading Datasets into Google Drive via Google Colab • https://towardsdatascience.com/downloading-datasets-into-google-drive-via- google-colab-bcb1b30b0166 30 interacting_table.ipynb colab_charts.ipynb
  31. 31. Flower classification • The model will take as input a photo of a flower and return whether it is a daisy, dandelion, rose, sunflower, or tulip. • Using keras framework on TPU tensorflow 2.x. 31 The code is from: https://colab.research.google.com/notebooks/tpu.ipynb tpu_colab.ipynb
  32. 32. Homework • Try to create a iris classification project on colab follow the link below. • https://medium.com/@yosik81/machine-learning-in-30-minutes- with-python-and-google-colab-6e6dfb77f5e1 32

×