Visitar URL original
Update TensorFlow backend for Python 3.12 compatibility (Keras 2 via `tf-keras`) by maximpavliv · Pull Request #3087 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aa1cafe
Relax pyside6
maximpavliv Sep 4, 2025
ae989b1
Relax tensorflow non-Windows
maximpavliv Sep 4, 2025
a7a8a86
Add higher python releases to CI/CD
maximpavliv Sep 4, 2025
05cf09a
Relax tensorflow in CI/CD
maximpavliv Sep 4, 2025
17c4e13
Relax pytables in CI/CD
maximpavliv Sep 4, 2025
0f7c454
Remove pytables from CI/CD installation
maximpavliv Sep 4, 2025
79e54a9
Install tf-keras for tensorflow>=2.16 support
maximpavliv Sep 4, 2025
40d159a
Add TF_USE_LEGACY_KERAS env var to CI/CD
maximpavliv Sep 6, 2025
2a1de93
TMP Add tables to requirements?
maximpavliv Sep 6, 2025
bf51dbc
Add _tf_legacy.py
maximpavliv Sep 8, 2025
57ca3f6
TMP try install specific wrapt version?
maximpavliv Sep 8, 2025
b4aca6e
Set WRAPT_DISABLE_EXTENSIONS env var
maximpavliv Sep 8, 2025
74b48a0
Exclude Windows & python=3.13 from CI/CD
maximpavliv Sep 8, 2025
01c3008
TMP tf macos pin
maximpavliv Sep 8, 2025
d597152
Remove python 3.12 from cicd
maximpavliv Sep 8, 2025
d08878e
Try pin tensorflow-macos==2.15.0
maximpavliv Sep 8, 2025
e6655f7
TMP try unpin tensorflow-macos and add tf-keras
maximpavliv Sep 8, 2025
a6fd9a9
Replace macos-14 by macos-latest
maximpavliv Sep 9, 2025
8b8ec8c
Set dataloader_workers to 0
maximpavliv Sep 9, 2025
f1ccf01
Add tables to setup.py
maximpavliv Sep 9, 2025
db39c94
Relax tensorflow-macos
maximpavliv Sep 9, 2025
fb8bd4e
Update 3mice colab installation
maximpavliv Sep 9, 2025
23d4bc3
Update modelzoo reid colab installations
maximpavliv Sep 9, 2025
6fe5238
Merge branch 'main' into maxim/relax_dependencies
maximpavliv Sep 12, 2025
4cc497d
Merge branch 'main' into maxim/relax_dependencies
maximpavliv Sep 16, 2025
1f3806e
Merge branch 'main' into maxim/relax_dependencies
maximpavliv Sep 22, 2025
8c8dbf6
Merge branch 'main' into maxim/relax_dependencies
maximpavliv Oct 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update modelzoo reid colab installations
  • Loading branch information
maximpavliv committed Sep 9, 2025
commit 23d4bc3e99d41a11d2ff3cc4bb031ae6ff69f665
38 changes: 2 additions & 36 deletions examples/COLAB/COLAB_DLC_ModelZoo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,7 @@
"\n",
"## **Let's get going: install DeepLabCut into COLAB:**\n",
"\n",
"*Also, be sure you are connected to a GPU: go to menu, click Runtime > Change Runtime Type > select \"GPU\"*\n",
"\n",
"As the COLAB environments were updated to CUDA 12.X and Python 3.11, we need to install DeepLabCut and TensorFlow in a distinct way to get TensorFlow to connect to the GPU."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Install TensorFlow, tensorpack and tf_slim versions compatible with DeepLabCut\n",
"!pip install \"tensorflow==2.12.1\" \"tensorpack>=0.11\" \"tf_slim>=1.1.0\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Downgrade PyTorch to a version using CUDA 11.8 and cudnn 8\n",
"# This will also install the required CUDA libraries, for both PyTorch and TensorFlow\n",
"!pip install torch==2.3.1 torchvision --index-url https://download.pytorch.org/whl/cu118"
"*Also, be sure you are connected to a GPU: go to menu, click Runtime > Change Runtime Type > select \"GPU\"*\n"
]
},
{
Expand All @@ -78,18 +55,7 @@
"outputs": [],
"source": [
"# Install the latest version of DeepLabCut\n",
"!pip install \"git+https://github.com/DeepLabCut/DeepLabCut.git#egg=deeplabcut[modelzoo]\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# As described in https://www.tensorflow.org/install/pip#step-by-step_instructions, \n",
"# create symbolic links to NVIDIA shared libraries:\n",
"!ln -svf /usr/local/lib/python3.11/dist-packages/nvidia/*/lib/*.so* /usr/local/lib/python3.11/dist-packages/tensorflow"
"!pip install --pre \"deeplabcut[tf,modelzoo]\""
]
},
{
Expand Down
108 changes: 3 additions & 105 deletions examples/COLAB/COLAB_transformer_reID.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,91 +32,18 @@
"- a quick guide to maDLC: https://deeplabcut.github.io/DeepLabCut/docs/tutorial.html\n",
"- a demo COLAB for how to use maDLC on your own data: https://github.com/DeepLabCut/DeepLabCut/blob/main/examples/COLAB/COLAB_maDLC_TrainNetwork_VideoAnalysis.ipynb\n",
"\n",
"### To get started, please go to \"Runtime\" ->\"change runtime type\"->select \"Python3\", and then select \"GPU\"\n",
"\n",
"As the COLAB environments were updated to CUDA 12.X and Python 3.11, we need to install DeepLabCut and TensorFlow in a distinct way to get TensorFlow to connect to the GPU."
"### To get started, please go to \"Runtime\" ->\"change runtime type\"->select \"Python3\", and then select \"GPU\"\n"
]
},
{
"cell_type": "markdown",
"source": [
"‼️ **Attention: this demo is for maDLC, which is version 2.2**\n",
"- the installation is very slow on Colab due to the several steps needed to use older versions of `torch` and `dlc`."
"‼️ **Attention: this demo is for maDLC, which is version 2.2**\n"
],
"metadata": {
"id": "xOe2hvy85EVP"
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "6_Q4_GKM45Oe"
},
"outputs": [],
"source": [
"# Downgrade PyTorch to a version using CUDA 11.8 and cudnn 8\n",
"# This will also install the required CUDA libraries, for both PyTorch and TensorFlow\n",
"!pip install torch==2.3.1 torchvision --index-url https://download.pytorch.org/whl/cu118"
]
},
{
"cell_type": "code",
"source": [
"import torch\n",
"print(torch.cuda.is_available())\n",
"print(torch.cuda.get_device_name(0))\n",
"!nvcc --version # sometimes not available"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "3HLeBRGL9jYJ",
"outputId": "b8e49307-f51c-4f12-8dec-d2c2929928e2"
},
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"True\n",
"NVIDIA A100-SXM4-40GB\n",
"nvcc: NVIDIA (R) Cuda compiler driver\n",
"Copyright (c) 2005-2024 NVIDIA Corporation\n",
"Built on Thu_Jun__6_02:18:23_PDT_2024\n",
"Cuda compilation tools, release 12.5, V12.5.82\n",
"Build cuda_12.5.r12.5/compiler.34385749_0\n"
]
}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "Vz3B6Zyf45Od"
},
"outputs": [],
"source": [
"# Install TensorFlow, tensorpack and tf_slim versions compatible with DeepLabCut\n",
"!pip install \"tensorflow==2.12.1\" \"tensorpack>=0.11\" \"tf_slim>=1.1.0\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "UUpac75T45Of"
},
"outputs": [],
"source": [
"# As described in https://www.tensorflow.org/install/pip#step-by-step_instructions,\n",
"# create symbolic links to NVIDIA shared libraries:\n",
"!ln -svf /usr/local/lib/python3.11/dist-packages/nvidia/*/lib/*.so* /usr/local/lib/python3.11/dist-packages/tensorflow"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -126,15 +53,13 @@
"outputs": [],
"source": [
"# Install DLC version 2.2-2.3 (pre DLC3):\n",
"!pip install deeplabcut==2.3.11"
"!pip install \"deeplabcut[tf]\""
]
},
{
"cell_type": "code",
"source": [
"import tensorflow\n",
"import deeplabcut\n",
"import torch\n",
"import os"
],
"metadata": {
Expand All @@ -143,33 +68,6 @@
"execution_count": 3,
"outputs": []
},
{
"cell_type": "code",
"source": [
"print(\"DLC version: \", deeplabcut.__version__)\n",
"print(\"torch version: \",torch.__version__)\n",
"print(\"tensorflow version: \",tensorflow.__version__)\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "wRojzQO98X2H",
"outputId": "fad889d6-15da-4888-8138-283f1f13cf99"
},
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"DLC version: 2.3.11\n",
"torch version: 2.3.1+cu118\n",
"tensorflow version: 2.12.1\n"
]
}
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down