09.05.2023 Views

pdfcoffee

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

TensorFlow and Cloud

In case you require to install a specific version or a module not part of the default

Colaboratory environment you can use pip install or apt-get install. For

example, the following command on being executed in the Colab notebook cell will

install TensorFlow GPU 2.0 version:

! pip install tensorflow-gpu

At the time of writing this book the default version of TensorFlow

was 1.15, with a message that it will be shifting soon to TensorFlow

2.0, the NumPy version was 1.17.3, Matplotlib 3.1.1, and Pandas

0.25.3.

If you are interested to know the hardware details of the environment where

Colaboratory notebooks run, you can get the info using the cat command:

For processor:

!cat /proc/cpuinfo

For memory:

!cat /proc/meminfo

To run these starting commands and get the version information for your region, you

can use the following Colaboratory Notebook:

https://colab.research.google.com/drive/1i60H5hcJShrMKhytBUlItJ7Win0o

FjM6

Just like the standard Jupyter notebook, you can run the Unix command line

commands directly in the Notebook prefixed by an exclamation mark "!".

You can also mount your Google Drive and access the files you have saved in your

drive. To do this you will use:

from google.colab import drive

drive.mount('/content/drive/')

This will generate a link. After clicking the link you will get an authorization code,

and entering the authorization code will give the notebook access to your drive. You

can check the content of your drive using !ls "/content/drive/My Drive" and

access any of the folders in it by specifying the path.

The Colab interface is very similar to Jupyter, so now you are all set to run your

machine learning experiments on Colaboratory. One disadvantage of Colaboratory is

that it does not work well in presentation mode. Fortunately, for that we have Azure

Notebooks.

[ 454 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!