[Support] Jupyter-TensorFlow_OpenCV and Jupyter-CuDNN_TensorFlow_OpenCV


Recommended Posts

December 2023 update:

Please note that a new version under a different location and repository is available.

Please search for Jupyter-CTPO and Jupyter-TPO, added to the CA in early December 2023

 

 

 

 

 

 

 

 

 

 

Unraid support thread for Jupyter-TensorFlow_OpenCV and Jupyter-CuDNN_TensorFlow_OpenCV (short FAQ in next message)

 

For Jupyter-CuDNN_TensorFlow_OpenCV:  If you have multiple GPUs with some allocated to VMs, make sure to change --gpus all (see below)

 

The default password for the notebook is dmc

 

The system is run as the jupyter user (has sudo privileges) and /dmc is where you can place your weights and other files to support your development.


Jupyter-TensorFlow_OpenCV (> 4GB download)

Unraid compatible Jupyter Notebook (Python kernel) container with CPU-ready Tensorflow, OpenCV, Pandas, PyTorch, ...

Based on https://hub.docker.com/r/datamachines/tensorflow_opencv which is built as part of https://github.com/datamachines/cuda_tensorflow_opencv


Jupyter-CuDNN_TensorFlow_OpenCV (> 16GB download)

Unraid compatible Jupyter Notebook (Python kernel) container with GPU-optimized Tensorflow and OpenCV, and installations of Pandas, PyTorch, ...

This GPU-bound container requires the Nvidia driver installed on your Unraid server with support for Docker. This driver needs to support the version of CUDA in use by this container. The template adds --gpus all to the way the docker container is started to get access to the GPU(s).
Based on https://hub.docker.com/r/datamachines/cudnn_tensorflow_opencv which is built as part of https://github.com/datamachines/cuda_tensorflow_opencv

 

 The Unraid Nvidia Plugin is available in the community apps store

 

 If you have multiple GPUs in your system with some allocated to VMs, make sure to replace --gpus all with --runtime=nvidia and follow the steps below to set the NVIDIA_DRIVER_CAPABILITIES and NVIDIA_VISIBLE_DEVICES variables to only give the container access to selected GPUs.

In the next entry, you will find a small FAQ covering the following:

- Changing the default password

- Shared Memory

- Get versions information for OpenCV and TensorFlow

- List of pre-installed pip3 packages and their versions (including PyTorch)

- Obtain more complete build details

- Check available GPU resources (GPU version only)

- Persisting user's installs/changes
 

Changelog:

- 20220815: new release: (CUDA 11.3.1) TensorFlow 2.9.1, OpenCV 4.6.0 and PyTorch 1.12.1

- 20220530: new release: (CUDA 11.3.1) TensorFlow 2.9.1, OpenCV 4.5.5 and PyTorch 1.11 (PyTorch is now built from source)

- 20220525: new release: (CUDA 11.3.1) TensorFlow 2.9.1, OpenCV 4.5.5

- 20220521: new release: (CUDA: 11.3.1) TensorFlow 2.9.0 and OpenCV 4.5.5

- 20220510: new release: (CUDA: 11.3.1) TensorFlow 2.8.0 and OpenCV 4.5.5 with updated base containers, including Nvidia's new package signing key

- 20220509: Added FAQ table of content

- 20220422: Multiple GPUs note

- 20220403: Updated unraid template

- 20220402: Container updated to fix issue preventing change of default password (same components)

- 20220331: Initial release: latest is (CUDA: 11.3.1) TensorFlow 2.8.0 and OpenCV 4.5.5

 

Edited by martial
Pointing to recent Jupyter-CTPO
  • Like 1
Link to comment

Short FAQ

--- Changing the default password

  1. In a running instance of the container, after login in,
  2. Start a "New" "Terminal" in the currently running NoteBook.

  3. Grant your user permission to modify the file where the password is stored using sudo chown jupyter.users /home/jupyter/.jupyter/jupyter_notebook_config.json (to prevent a possible permission error --not needed with update done on Container Image released on 20220402)

  4. From the shell prompt, type jupyter notebook password and entering your desired new password.

  5. In the Unraid Docker UI, Stop the container, then Start it again.

  6. When accessing the WebUI your new password will let you in.

 

 

--- Shared Memory

Please note that ML frameworks use shared memory. The amount of shared memory provided to your container can be modified by adding --shm-size=2G (adapt to what you are comfortable giving the container) in the "Extra Parameters:" section.

 

 

--- Get versions information for OpenCV and TensorFlow

Once the Notebook is started, you can create a "New" "Python3" notebook and use

import tensorflow as tf
import cv2
print(cv2.__version__)
print(tf.__version__)

 

 

--- List of pre-installed pip3 packages and their versions (including PyTorch)

In a "New" "Terminal" (we recommend switching to a bash prompt), you can run

/tmp/tf_info.sh

 

 

---Obtain more complete build details

Check the container components version you are using (CUDA --if applicable--, TensorFlow, OpenCV) and compare it against the list of available ones on the DockerHub page (https://hub.docker.com/r/datamachines/jupyter_to-unraid or https://hub.docker.com/r/datamachines/jupyter_cto-unraid) and search the tags for the right match.

For CUDA 11.3.1, Tensorflow 2.8.0, OpenCV 4.5.5, you will find 11.3.1_2.8.0_4.5.5-20220318 this value is the same value as the one of the base container those are built "FROM" and be seen in https://hub.docker.com/r/datamachines/tensorflow_opencv and https://hub.docker.com/r/datamachines/cudnn_tensorflow_opencv

There you will see tables linking you to further details about those builds.

 

 

--- Check available GPU resources (GPU version only)

To confirm the GPU is accessible from within the container, from a "Terminal" run nvidia-smi to see the GPU resources available to you. If nothing appears, make sure the Nvidia driver is installed and configured and that the "Extra Parameters" of your container's settings contains --gpus all (added in the default template)
 

--- Persisting user's installs/changes
If you install software or pip packages, those will not persist a container restart.

For further details, see https://github.com/datamachines/cuda_tensorflow_opencv/issues/30#issuecomment-1120455956

The following is written for the "Jupyter-TensorFlow_OpenCV" container, so please adapt as required for its "Jupyter-CuDNN_TensorFlow_OpenCV" counterpart.

Persisting your "Custom" installation requires you to have the container still running and access to a Terminal on your Unraid server.

- [terminal] Do a docker ps to confirm "Jupyter-TensorFlow_OpenCV" is running.

- [terminal] run docker commit Jupyter-TensorFlow_OpenCV jupyter_to-custom:latest to create a new image named "jupyter_to-custom:latest" based on your changes

- [terminal] confirm it is showing in a docker images listing

- [WebUI] the "Docker" Tab's "Advanced View" will now show you an "Orphan Image", so it is a matter of creating a new template for this image in the /boot/config/plugins/dockerMan directory

- [terminal] cd /boot/config/plugins/dockerMan/templates-user followed by cp my-Jupyter-TensorFlow_OpenCV.xml my-Jupyter-TensorFlow_OpenCV-Custom.xml

- [WebUI] in the "Docker" tab, "Add Container" and use the newly available "Jupyter-TensorFlow_OpenCV-Custom" one. Edit the "Name" to be Jupyter-TensorFlow_OpenCV-Custom; this is important because if you have a "Jupter-TensorFlow-OpenCV" version already installed, it will overwrite that template when you apply this one otherwise (ie the filename use this "Name"). Change the "Repository" to be the image recently created: jupyter_to-custom:latest. Remove the content of the "Docker Hub URL". Change the "WebUI" port to be one that is not already in use. When clicking "Apply" you should get "The command finished successfully!", otherwise check the settings again.

- [WebUI] in the "Docker" tab, you should now have a "Jupyter-TensorFlow_OpenCV-Custom" available to use. A "not available" will be displayed in the "VERSION" column; this is normal: the container can not be updated automatically.

 

Edited by martial
Added "Persisting user's installs/changes" section
Link to comment
  • martial changed the title to [Support] Jupyter-TensorFlow_OpenCV and Jupyter-CuDNN_TensorFlow_OpenCV
  • 1 month later...
33 minutes ago, yayitazale said:

Hi:

 

I want to use this jupyter docker as a remote server from my VSCODE on my PC. Where I can get the token? I don't see it on the containers logs at startup. Also, I'm not able to change the default password since I don't see the option to open a terminal in an active notebook.

 

Thanks

Ok I managed to change the password following your steps from the containers console, and also creating a token to allow remote access following this:

https://stackoverflow.com/questions/61125843/how-to-enable-token-authentication-in-jupyter-notebook

 

 

Link to comment
On 9/22/2022 at 10:48 AM, yayitazale said:

Ok I managed to change the password following your steps from the containers console, and also creating a token to allow remote access following this:

https://stackoverflow.com/questions/61125843/how-to-enable-token-authentication-in-jupyter-notebook

 

Thanks for this information, would you be able to post the steps involved and I will add them to the FAQ?

Link to comment
4 hours ago, martial said:

 

Thanks for this information, would you be able to post the steps involved and I will add them to the FAQ?

  1. Enter to the containers console
  2. Install nano with "sudo apt install nano"
  3. Edit the jupyter_notebook_config.json file with "sudo nano /home/jupyter/.jupyter/jupyter_notebook_config.json"
  4. Add this entry to the file using a only numbers and letters token: "token": "YOUR_TOKEN"
  5. Save the file and restart the container

In any case, I'm no t sure if this change will be preserved if I update the container.

Link to comment
  • 3 months later...
On 1/13/2023 at 8:20 AM, adambeck7 said:

Sorry if this is a dumb question, but can either of these be used with a Coral TPU?

It is a good question.

The base container is "FROM nvidia:cuda-" to get the GPU optimizations for Nvidia devices.

I do not own a Coral TPU, so I have not tried to see if I could build the container for this hardware, but if you are interested in trying, the source for the container build is public (see the first post).

 

Link to comment
  • 4 months later...
On 6/8/2023 at 12:28 AM, u218654 said:

So this container is HUGE on the docker.img...like 16GB. Looks like this is mostly in the /usr folder of the Docker. I might be dumb here....but how can I remap the /usr folder to somewhere on the array?

Unfortunately, not easily.

The base container is always going to be the same size, it is the size of building and installing the independent components.

 

My solution to avoid the size limitation for docker on Unraid has been to not use the docker.img which has a limited disk space and instead use a directory which reside (preferred) on a cache disk to have all the containers, and therefore all the free space on that directory (disk) will be available for your containers.

 

This link ought to help with that process.

 

Thanks for this question.

Hope this helps

Link to comment
  • 5 weeks later...

Tensor / Jupyter newbie, has anyone else seen this error when trying to run something on the GPU?

 

```

2023-07-10 00:45:25.586797: W tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at xla_ops.cc:296 : UNIMPLEMENTED: Could not find compiler for platform CUDA: NOT_FOUND: could not find registered compiler for platform CUDA -- check target linkage (hint: try adding tensorflow/compiler/jit:xla_gpu_jit as a dependency)

```

 

I'm guessing that it needs to be included in a build file.

Link to comment
14 hours ago, pengying said:

2023-07-10 00:45:25.586797: W tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at xla_ops.cc:296 : UNIMPLEMENTED: Could not find compiler for platform CUDA: NOT_FOUND: could not find registered compiler for platform CUDA -- check target linkage (hint: try adding tensorflow/compiler/jit:xla_gpu_jit as a dependency)

This looks to me like nvcc did not find the proper support for your hardware. What is your GPU?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.