Easy keras-TF docker file?

Hello all! Anybody know of any good docker images that’ll run on a Xavier NX with a Keras frontend for TF? I note that NGC files don’t have keras in the docker files, due to its rapid changes and the fact that it can be a frontend for multiple things. I tried just running “pip3 install keras” in the m4L container (and it said it worked), but then started getting errors about having the wrong tensorflow installed when I wanted to import things. I just want one that works out of the box!

And yes, I know, training my own models on the xavier is going to be comparatively slow. It’s my only option right now, unless someone at NVidia has a spare 3080 laying around in the back I can buy! (My ancient geforce 760 won’t run modern tensorflow, haha). And yes, I see that pytorch is on plenty of the NGC docker files, but I’m more well-versed in keras! I could probably pick pytorch up quickly enough, but kinda don’t want to!

Hi,

Keras is integrated into the TensorFlow package.
So you can use either l4t-tensorflow or l4t-ml container.

For example:

$ sudo docker run -it --rm --runtime nvidia --network host nvcr.io/nvidia/l4t-tensorflow:r32.4.4-tf2.3-py3
>root@nvidia-desktop:/# python3
Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>  from tensorflow import keras
2020-11-26 02:57:27.379252: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.2

Thanks.

Aaaah. Oops! I got confused. I was trying to use image_dataset_from_directory() and was having a lot of import problems, and assumed the whole library was missing. It looks like maybe that bit of preprocessing is not in all the tf installs? An issue thread I saw with it said that I need to install tf-nightly to get at it. I tried pip3 install tf-nightly in the container but it couldn’t find it. Any advice there? Thanks for your help!

Hi,

We can run import tensorflow.keras.preprocessing without issue on the l4t-tensorflow:r32.4.4-tf2.3-py3 image.
Please also give it a try.

For Jetson, you won’t be able to install tensorflow through *pip3ˇ directly since it is an ARM system.
More, if the community recommends you to install the nightly build, it is quite possible that the fix is merged into the latest TensorFlow already.

Thanks.

Here’s a screenshot of what happens when I attempt to import the function in question on the Jetson. Note, this is in the l4t-ml container.

Here’s a stack overflow thread on it, for reference (or for anyone else coming along looking for an answer to the same question)
Thanks for helping!
image

Doh, didn’t include SO link:

Hi,

Which TF version do you use?

The link indicates the module haven’t been included into the v2.1.x or v2.2.0.
But in our latest docker, TensorFlow version is already v2.3 and the module can be imported without issue.

Thanks.