RealTimeAI-NVIDIA-CUDA

classroom

AI & ML interests

Torch AI Development using NVIDIA CUDA, Pytorch, Python-3.10, GPU/TPU, Local Model AI Using NVIDIA RTX 3070 on Windows 11

This demonstration classroom shows installation and compute based AI model development using torch with Hardware compatibility with Windows 11 platform running with NVIDIA RTX 3070.

  1. Install VSCode, latest version. Add all Microsoft Extensions.
  2. Install Python 3.10.11 and 3.12.1 - Pytorch will need 3.10.x or lower at time of this. Important to launch installer and run as Administrator.
  3. Keep installer for py3.10 around - easy way to reset is to uninstall and reinstall this to redo py envs.
  4. Download and install NVIDIA CUDA version 12.3 for Windows 11.
  5. Use custom and uncheck NSIGHT Visual Studio Edition assuming you already have VSCode or VS22 locally installed.
  6. Test Geforce Experience. Use MS Authenticator to add NVidia for MFA.
  7. Update GeForce Game Ready Driver to current 12/12/2023 v 546.33
  8. Check your paths and make sure that python was installed as Administrator to keep all file perms clear.
  9. Test Out running pip install with all GPU requirements.txt that you will use. Below is what my session looks like.

clean pip install of requirements.txt:

C:\Users\aaron\src\2024-01-02\RTI>type requirements.txt
diffusers==0.23.0
transformers==4.34.1
gradio==4.1.2
--extra-index-url https://download.pytorch.org/whl/cu121
torch==2.1.0
fastapi==0.104.0
uvicorn==0.23.2
Pillow==10.1.0
accelerate==0.24.0
compel==2.0.2
controlnet-aux==0.0.7
peft==0.6.0
xformers

C:\Users\aaron>path
PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\libnvvp;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\dotnet\;%NVM_HOME%;%NVM_SYMLINK%;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2023.3.1\;C:\Users\aaron\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\aaron\AppData\Local\Programs\Python\Python310\;C:\Users\aaron\AppData\Local\Microsoft\WindowsApps;C:\Users\aaron\.dotnet\tools;C:\Users\aaron\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\aaron\AppData\Roaming\npm

C:\Users\aaron>cd C:\Users\aaron\AppData\Local\Programs\Python\Python310\

C:\Users\aaron\AppData\Local\Programs\Python\Python310>dir
 Volume in drive C is Windows
 Volume Serial Number is 64F6-3D28

 Directory of C:\Users\aaron\AppData\Local\Programs\Python\Python310

01/02/2024  11:32 AM    <DIR>          .
01/02/2024  11:32 AM    <DIR>          ..
01/02/2024  11:32 AM    <DIR>          DLLs
01/02/2024  11:32 AM    <DIR>          Doc
01/02/2024  11:32 AM    <DIR>          include
01/02/2024  11:32 AM    <DIR>          Lib
01/02/2024  11:32 AM    <DIR>          libs
04/05/2023  12:47 AM            32,768 LICENSE.txt
04/05/2023  12:48 AM         1,306,983 NEWS.txt
04/05/2023  12:47 AM           103,192 python.exe
04/05/2023  12:47 AM            66,328 python3.dll
04/05/2023  12:47 AM         4,458,776 python310.dll
04/05/2023  12:47 AM           101,656 pythonw.exe
01/02/2024  11:32 AM    <DIR>          Scripts
01/02/2024  11:32 AM    <DIR>          tcl
01/02/2024  11:32 AM    <DIR>          Tools
04/05/2023  12:47 AM            98,224 vcruntime140.dll
04/05/2023  12:47 AM            37,256 vcruntime140_1.dll
               8 File(s)      6,205,183 bytes
              10 Dir(s)  31,767,810,048 bytes free

C:\Users\aaron\AppData\Local\Programs\Python\Python310>cd C:\Users\aaron\src\2024-01-02

C:\Users\aaron\src\2024-01-02>dir
 Volume in drive C is Windows
 Volume Serial Number is 64F6-3D28

 Directory of C:\Users\aaron\src\2024-01-02

01/02/2024  10:36 AM    <DIR>          .
01/02/2024  09:11 AM    <DIR>          ..
01/02/2024  10:25 AM     3,281,693,944 cuda_12.3.1_546.12_windows10.exe
01/02/2024  10:10 AM     3,281,693,944 cuda_12.3.1_546.12_windows11.exe
01/02/2024  10:32 AM        30,873,680 cuda_12.3.1_windows_network.exe
01/02/2024  10:36 AM       542,474,240 nsight_visual_studio_edition-windows-x86_64-2023.3.1.23311_33505173.msi
01/02/2024  09:42 AM        29,037,240 python-3.10.11-amd64.exe
01/02/2024  09:26 AM        26,589,696 python-3.12.1-amd64.exe
01/02/2024  09:16 AM    <DIR>          RTI
               6 File(s)  7,192,362,744 bytes
               3 Dir(s)  31,767,457,792 bytes free

C:\Users\aaron\src\2024-01-02>cd RTI

C:\Users\aaron\src\2024-01-02\RTI>dir
 Volume in drive C is Windows
 Volume Serial Number is 64F6-3D28

 Directory of C:\Users\aaron\src\2024-01-02\RTI

01/02/2024  09:16 AM    <DIR>          .
01/02/2024  10:36 AM    <DIR>          ..
01/02/2024  09:15 AM    <DIR>          .streamlit
01/02/2024  09:15 AM    <DIR>          .vscode
01/02/2024  09:16 AM            10,639 app.py
01/02/2024  09:16 AM            11,048 backup.app.py
01/02/2024  09:16 AM               253 README.md
01/02/2024  11:18 AM               341 requirements.txt
               4 File(s)         22,281 bytes
               4 Dir(s)  31,767,457,792 bytes free

C:\Users\aaron\src\2024-01-02\RTI>pip install -r requirements.txt
ERROR: Invalid requirement: '//pip3 install torch torchvision torchaudio' (from line 14 of requirements.txt)

[notice] A new release of pip is available: 23.0.1 -> 23.3.2
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\Users\aaron\src\2024-01-02\RTI>notepad requirements.txt

C:\Users\aaron\src\2024-01-02\RTI>pip install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu121
Collecting diffusers==0.23.0
  Downloading diffusers-0.23.0-py3-none-any.whl (1.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 13.3 MB/s eta 0:00:00
Collecting transformers==4.34.1
  Downloading transformers-4.34.1-py3-none-any.whl (7.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.7/7.7 MB 71.0 MB/s eta 0:00:00
Collecting gradio==4.1.2
  Downloading gradio-4.1.2-py3-none-any.whl (15.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.4/15.4 MB 81.8 MB/s eta 0:00:00
Collecting torch==2.1.0
  Downloading https://download.pytorch.org/whl/cu121/torch-2.1.0%2Bcu121-cp310-cp310-win_amd64.whl (2473.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 GB 1.7 MB/s eta 0:00:00
Collecting fastapi==0.104.0
  Downloading fastapi-0.104.0-py3-none-any.whl (92 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 92.9/92.9 kB 1.8 MB/s eta 0:00:00
Collecting uvicorn==0.23.2
  Downloading uvicorn-0.23.2-py3-none-any.whl (59 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.5/59.5 kB 80.8 kB/s eta 0:00:00
Collecting Pillow==10.1.0
  Downloading Pillow-10.1.0-cp310-cp310-win_amd64.whl (2.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 3.0 MB/s eta 0:00:00
Collecting accelerate==0.24.0
  Downloading accelerate-0.24.0-py3-none-any.whl (260 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 261.0/261.0 kB 229.4 kB/s eta 0:00:00
Collecting compel==2.0.2
  Downloading compel-2.0.2-py3-none-any.whl (30 kB)
Collecting controlnet-aux==0.0.7
  Downloading controlnet_aux-0.0.7.tar.gz (202 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 202.4/202.4 kB 84.3 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting peft==0.6.0
  Downloading peft-0.6.0-py3-none-any.whl (134 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.9/134.9 kB 106.4 kB/s eta 0:00:00
Collecting xformers
  Downloading https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp310-cp310-win_amd64.whl (201.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 201.1/201.1 MB 5.2 MB/s eta 0:00:00
Collecting safetensors>=0.3.1
  Downloading safetensors-0.4.1-cp310-none-win_amd64.whl (277 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 277.3/277.3 kB 416.6 kB/s eta 0:00:00
Collecting huggingface-hub>=0.13.2
  Downloading huggingface_hub-0.20.1-py3-none-any.whl (330 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 330.1/330.1 kB 135.5 kB/s eta 0:00:00
Collecting regex!=2019.12.17
  Downloading regex-2023.12.25-cp310-cp310-win_amd64.whl (269 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 269.5/269.5 kB 2.4 MB/s eta 0:00:00
Collecting requests
  Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Collecting importlib-metadata
  Downloading importlib_metadata-7.0.1-py3-none-any.whl (23 kB)
Collecting filelock
  Downloading filelock-3.13.1-py3-none-any.whl (11 kB)
Collecting numpy
  Downloading numpy-1.26.2-cp310-cp310-win_amd64.whl (15.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.8/15.8 MB 7.0 MB/s eta 0:00:00
Collecting pyyaml>=5.1
  Downloading PyYAML-6.0.1-cp310-cp310-win_amd64.whl (145 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 145.3/145.3 kB 105.5 kB/s eta 0:00:00
Collecting packaging>=20.0
  Using cached packaging-23.2-py3-none-any.whl (53 kB)
Collecting tokenizers<0.15,>=0.14
  Downloading tokenizers-0.14.1-cp310-none-win_amd64.whl (2.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 3.3 MB/s eta 0:00:00
Collecting tqdm>=4.27
  Downloading tqdm-4.66.1-py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.3/78.3 kB 361.8 kB/s eta 0:00:00
Collecting typing-extensions~=4.0
  Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Collecting jinja2<4.0
  Downloading https://download.pytorch.org/whl/Jinja2-3.1.2-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 kB 117.3 kB/s eta 0:00:00
Collecting matplotlib~=3.0
  Downloading matplotlib-3.8.2-cp310-cp310-win_amd64.whl (7.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.6/7.6 MB 54.1 MB/s eta 0:00:00
Collecting python-multipart
  Downloading python_multipart-0.0.6-py3-none-any.whl (45 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.7/45.7 kB 454.8 kB/s eta 0:00:00
Collecting importlib-resources<7.0,>=1.3
  Downloading importlib_resources-6.1.1-py3-none-any.whl (33 kB)
Collecting ffmpy
  Downloading ffmpy-0.3.1.tar.gz (5.5 kB)
  Preparing metadata (setup.py) ... done
Collecting markupsafe~=2.0
  Downloading https://download.pytorch.org/whl/MarkupSafe-2.1.3-cp310-cp310-win_amd64.whl (17 kB)
Collecting httpx
  Downloading httpx-0.26.0-py3-none-any.whl (75 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.9/75.9 kB 2.1 MB/s eta 0:00:00
Collecting orjson~=3.0
  Downloading orjson-3.9.10-cp310-none-win_amd64.whl (135 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 135.0/135.0 kB 8.3 MB/s eta 0:00:00
Collecting typer[all]<1.0,>=0.9
  Downloading typer-0.9.0-py3-none-any.whl (45 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.9/45.9 kB 50.6 kB/s eta 0:00:00
Collecting gradio-client==0.7.0
  Downloading gradio_client-0.7.0-py3-none-any.whl (302 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 302.7/302.7 kB 9.4 MB/s eta 0:00:00
Collecting pandas<3.0,>=1.0
  Downloading pandas-2.1.4-cp310-cp310-win_amd64.whl (10.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.7/10.7 MB 65.6 MB/s eta 0:00:00
Collecting tomlkit==0.12.0
  Downloading tomlkit-0.12.0-py3-none-any.whl (37 kB)
Collecting pydantic>=2.0
  Downloading pydantic-2.5.3-py3-none-any.whl (381 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 381.9/381.9 kB 23.2 MB/s eta 0:00:00
Collecting altair<6.0,>=4.2.0
  Using cached altair-5.2.0-py3-none-any.whl (996 kB)
Collecting semantic-version~=2.0
  Downloading semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)
Collecting pydub
  Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)
Collecting aiofiles<24.0,>=22.0
  Downloading aiofiles-23.2.1-py3-none-any.whl (15 kB)
Collecting websockets<12.0,>=10.0
  Downloading websockets-11.0.3-cp310-cp310-win_amd64.whl (124 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 124.7/124.7 kB 7.6 MB/s eta 0:00:00
Collecting sympy
  Downloading https://download.pytorch.org/whl/sympy-1.12-py3-none-any.whl (5.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 73.5 MB/s eta 0:00:00
Collecting networkx
  Downloading networkx-3.2.1-py3-none-any.whl (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 102.3 MB/s eta 0:00:00
Collecting fsspec
  Downloading fsspec-2023.12.2-py3-none-any.whl (168 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 169.0/169.0 kB ? eta 0:00:00
Collecting starlette<0.28.0,>=0.27.0
  Downloading starlette-0.27.0-py3-none-any.whl (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 67.0/67.0 kB 3.5 MB/s eta 0:00:00
Collecting anyio<4.0.0,>=3.7.1
  Downloading anyio-3.7.1-py3-none-any.whl (80 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 80.9/80.9 kB 4.4 MB/s eta 0:00:00
Collecting click>=7.0
  Using cached click-8.1.7-py3-none-any.whl (97 kB)
Collecting h11>=0.8
  Downloading h11-0.14.0-py3-none-any.whl (58 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.3/58.3 kB ? eta 0:00:00
Collecting psutil
  Downloading psutil-5.9.7-cp37-abi3-win_amd64.whl (252 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 252.2/252.2 kB ? eta 0:00:00
Collecting pyparsing~=3.0
  Downloading pyparsing-3.1.1-py3-none-any.whl (103 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 103.1/103.1 kB 5.8 MB/s eta 0:00:00
Collecting scipy
  Downloading scipy-1.11.4-cp310-cp310-win_amd64.whl (44.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.1/44.1 MB 46.7 MB/s eta 0:00:00
Collecting opencv-python
  Downloading opencv_python-4.9.0.80-cp37-abi3-win_amd64.whl (38.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.6/38.6 MB 40.9 MB/s eta 0:00:00
Collecting einops
  Downloading einops-0.7.0-py3-none-any.whl (44 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.6/44.6 kB 2.1 MB/s eta 0:00:00
Collecting torchvision
  Downloading https://download.pytorch.org/whl/cu121/torchvision-0.16.2%2Bcu121-cp310-cp310-win_amd64.whl (5.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.6/5.6 MB 72.1 MB/s eta 0:00:00
Collecting timm
  Downloading timm-0.9.12-py3-none-any.whl (2.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 71.7 MB/s eta 0:00:00
Collecting scikit-image
  Downloading scikit_image-0.22.0-cp310-cp310-win_amd64.whl (24.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 24.5/24.5 MB 73.1 MB/s eta 0:00:00
Collecting xformers
  Downloading https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp310-cp310-win_amd64.whl (201.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 201.1/201.1 MB 13.1 MB/s eta 0:00:00
  Downloading https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp310-cp310-win_amd64.whl (202.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 202.1/202.1 MB 7.1 MB/s eta 0:00:00
Collecting toolz
  Using cached toolz-0.12.0-py3-none-any.whl (55 kB)
Collecting jsonschema>=3.0
  Using cached jsonschema-4.20.0-py3-none-any.whl (84 kB)
Collecting idna>=2.8
  Using cached idna-3.6-py3-none-any.whl (61 kB)
Collecting exceptiongroup
  Downloading exceptiongroup-1.2.0-py3-none-any.whl (16 kB)
Collecting sniffio>=1.1
  Using cached sniffio-1.3.0-py3-none-any.whl (10 kB)
Collecting colorama
  Downloading https://download.pytorch.org/whl/colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting contourpy>=1.0.1
  Downloading contourpy-1.2.0-cp310-cp310-win_amd64.whl (186 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 186.7/186.7 kB 161.4 kB/s eta 0:00:00
Collecting fonttools>=4.22.0
  Downloading fonttools-4.47.0-cp310-cp310-win_amd64.whl (2.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 69.9 MB/s eta 0:00:00
Collecting python-dateutil>=2.7
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting cycler>=0.10
  Downloading cycler-0.12.1-py3-none-any.whl (8.3 kB)
Collecting kiwisolver>=1.3.1
  Downloading kiwisolver-1.4.5-cp310-cp310-win_amd64.whl (56 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.1/56.1 kB 2.9 MB/s eta 0:00:00
Collecting tzdata>=2022.1
  Downloading tzdata-2023.4-py2.py3-none-any.whl (346 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 346.6/346.6 kB 21.0 MB/s eta 0:00:00
Collecting pytz>=2020.1
  Using cached pytz-2023.3.post1-py2.py3-none-any.whl (502 kB)
Collecting annotated-types>=0.4.0
  Downloading annotated_types-0.6.0-py3-none-any.whl (12 kB)
Collecting pydantic-core==2.14.6
  Downloading pydantic_core-2.14.6-cp310-none-win_amd64.whl (1.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 117.6 MB/s eta 0:00:00
Collecting urllib3<3,>=1.21.1
  Using cached urllib3-2.1.0-py3-none-any.whl (104 kB)
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl (100 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.3/100.3 kB 6.0 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
  Using cached certifi-2023.11.17-py3-none-any.whl (162 kB)
Collecting huggingface-hub>=0.13.2
  Downloading huggingface_hub-0.17.3-py3-none-any.whl (295 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 295.0/295.0 kB 17.8 MB/s eta 0:00:00
Collecting rich<14.0.0,>=10.11.0
  Using cached rich-13.7.0-py3-none-any.whl (240 kB)
Collecting shellingham<2.0.0,>=1.3.0
  Downloading shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
Collecting httpcore==1.*
  Downloading httpcore-1.0.2-py3-none-any.whl (76 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 76.9/76.9 kB 4.2 MB/s eta 0:00:00
Collecting zipp>=0.5
  Using cached zipp-3.17.0-py3-none-any.whl (7.4 kB)
Collecting tifffile>=2022.8.12
  Downloading tifffile-2023.12.9-py3-none-any.whl (223 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 223.6/223.6 kB 14.2 MB/s eta 0:00:00
Collecting lazy_loader>=0.3
  Downloading lazy_loader-0.3-py3-none-any.whl (9.1 kB)
Collecting imageio>=2.27
  Downloading imageio-2.33.1-py3-none-any.whl (313 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 313.3/313.3 kB 18.9 MB/s eta 0:00:00
Collecting mpmath>=0.19
  Downloading https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 16.4 MB/s eta 0:00:00
Collecting torchvision
  Downloading torchvision-0.16.2-cp310-cp310-win_amd64.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 75.2 MB/s eta 0:00:00
  Downloading https://download.pytorch.org/whl/cu121/torchvision-0.16.1%2Bcu121-cp310-cp310-win_amd64.whl (5.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.6/5.6 MB 59.9 MB/s eta 0:00:00
  Downloading torchvision-0.16.1-cp310-cp310-win_amd64.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 35.2 MB/s eta 0:00:00
  Downloading https://download.pytorch.org/whl/cu121/torchvision-0.16.0%2Bcu121-cp310-cp310-win_amd64.whl (5.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.8/5.8 MB 61.1 MB/s eta 0:00:00
Collecting rpds-py>=0.7.1
  Downloading rpds_py-0.16.2-cp310-none-win_amd64.whl (195 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 195.7/195.7 kB 6.0 MB/s eta 0:00:00
Collecting attrs>=22.2.0
  Downloading attrs-23.2.0-py3-none-any.whl (60 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.8/60.8 kB 3.4 MB/s eta 0:00:00
Collecting referencing>=0.28.4
  Using cached referencing-0.32.0-py3-none-any.whl (26 kB)
Collecting jsonschema-specifications>=2023.03.6
  Using cached jsonschema_specifications-2023.12.1-py3-none-any.whl (18 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pygments<3.0.0,>=2.13.0
  Using cached pygments-2.17.2-py3-none-any.whl (1.2 MB)
Collecting markdown-it-py>=2.2.0
  Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
Collecting mdurl~=0.1
  Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Installing collected packages: pytz, pydub, mpmath, ffmpy, zipp, websockets, urllib3, tzdata, typing-extensions, toolz, tomlkit, sympy, sniffio, six, shellingham, semantic-version, safetensors, rpds-py, regex, pyyaml, python-multipart, pyparsing, pygments, psutil, Pillow, packaging, orjson, numpy, networkx, mdurl, markupsafe, lazy_loader, kiwisolver, importlib-resources, idna, h11, fsspec, fonttools, filelock, exceptiongroup, einops, cycler, colorama, charset-normalizer, certifi, attrs, annotated-types, aiofiles, tqdm, tifffile, scipy, requests, referencing, python-dateutil, pydantic-core, opencv-python, markdown-it-py, jinja2, importlib-metadata, imageio, httpcore, contourpy, click, anyio, uvicorn, typer, torch, starlette, scikit-image, rich, pydantic, pandas, matplotlib, jsonschema-specifications, huggingface-hub, httpx, xformers, torchvision, tokenizers, jsonschema, gradio-client, fastapi, diffusers, accelerate, transformers, timm, altair, peft, gradio, controlnet-aux, compel
  DEPRECATION: ffmpy is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for ffmpy ... done
  DEPRECATION: controlnet-aux is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for controlnet-aux ... done
Successfully installed Pillow-10.1.0 accelerate-0.24.0 aiofiles-23.2.1 altair-5.2.0 annotated-types-0.6.0 anyio-3.7.1 attrs-23.2.0 certifi-2023.11.17 charset-normalizer-3.3.2 click-8.1.7 colorama-0.4.6 compel-2.0.2 contourpy-1.2.0 controlnet-aux-0.0.7 cycler-0.12.1 diffusers-0.23.0 einops-0.7.0 exceptiongroup-1.2.0 fastapi-0.104.0 ffmpy-0.3.1 filelock-3.13.1 fonttools-4.47.0 fsspec-2023.12.2 gradio-4.1.2 gradio-client-0.7.0 h11-0.14.0 httpcore-1.0.2 httpx-0.26.0 huggingface-hub-0.17.3 idna-3.6 imageio-2.33.1 importlib-metadata-7.0.1 importlib-resources-6.1.1 jinja2-3.1.2 jsonschema-4.20.0 jsonschema-specifications-2023.12.1 kiwisolver-1.4.5 lazy_loader-0.3 markdown-it-py-3.0.0 markupsafe-2.1.3 matplotlib-3.8.2 mdurl-0.1.2 mpmath-1.3.0 networkx-3.2.1 numpy-1.26.2 opencv-python-4.9.0.80 orjson-3.9.10 packaging-23.2 pandas-2.1.4 peft-0.6.0 psutil-5.9.7 pydantic-2.5.3 pydantic-core-2.14.6 pydub-0.25.1 pygments-2.17.2 pyparsing-3.1.1 python-dateutil-2.8.2 python-multipart-0.0.6 pytz-2023.3.post1 pyyaml-6.0.1 referencing-0.32.0 regex-2023.12.25 requests-2.31.0 rich-13.7.0 rpds-py-0.16.2 safetensors-0.4.1 scikit-image-0.22.0 scipy-1.11.4 semantic-version-2.10.0 shellingham-1.5.4 six-1.16.0 sniffio-1.3.0 starlette-0.27.0 sympy-1.12 tifffile-2023.12.9 timm-0.9.12 tokenizers-0.14.1 tomlkit-0.12.0 toolz-0.12.0 torch-2.1.0+cu121 torchvision-0.16.0+cu121 tqdm-4.66.1 transformers-4.34.1 typer-0.9.0 typing-extensions-4.9.0 tzdata-2023.4 urllib3-2.1.0 uvicorn-0.23.2 websockets-11.0.3 xformers-0.0.22.post7 zipp-3.17.0

[notice] A new release of pip is available: 23.0.1 -> 23.3.2
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\Users\aaron\src\2024-01-02\RTI>

Next, the streamlit library was not included in the library list due to the fact that this is a gradio app.
Since we are interested in UI for python of multiple flavors (gradio,streamlit,html5) lets also add streamlit.

To set up your vscode debugger, use the ability to create a ".vscode\launch.json" file inside your project code directory. This allows:

  1. to list program to launch during F5 debug for quick test of changes.
  2. to supply args like run or filename to run.
  3. to allow easy changes to test alternate files.

Example:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: Debugging in Visual Studio Code 22
    "version": "0.2.0",
    "configurations": [
        {
            "name": "debug streamlit",
            "type": "python",
            "request": "launch",
            //"program": "C:\\Users\\aaron\\AppData\\Local\\Programs\\Python\\Python310\\Scripts\\streamlit.exe",
            //"args": ["run","app.py"],
            "program": "C:\\Users\\aaron\\AppData\\Local\\Programs\\Python\\Python310\\Scripts\\gradio.exe",
            "args": ["app.py"],
            "console": "externalTerminal",
            "justMyCode": true
        }
    ]
}

Gradio if you observe will have a log showing launch and precalculations shown below:


PS C:\Users\aaron\src\2024-01-02\RTI> python app.py
A matching Triton is not available, some optimizations will not be enabled.
Error caught was: No module named 'triton'
SAFETY_CHECKER: None
TORCH_COMPILE: None
device: cuda
Downloading model_index.json: 100%|█████████████████████████████████████████████████████████████████████████████| 642/642 [00:00<?, ?B/s]
C:\Users\aaron\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\file_download.py:137: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\aaron\.cache\huggingface\hub. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.
To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to see activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
  warnings.warn(message)
Downloading (…)_encoder/config.json: 100%|██████████████████████████████████████████████████████████████████████| 724/724 [00:00<?, ?B/s]
Downloading (…)rocessor_config.json: 100%|██████████████████████████████████████████████████████████████████████| 520/520 [00:00<?, ?B/s] 
Downloading (…)cheduler_config.json: 100%|██████████████████████████████████████████████████████████████| 614/614 [00:00<00:00, 1.23MB/s] 
Downloading (…)cial_tokens_map.json: 100%|███████████████████████████████████████████████████████████████| 472/472 [00:00<00:00, 942kB/s] 
Downloading (…)_checker/config.json: 100%|███████████████████████████████████████████████████████████████| 796/796 [00:00<00:00, 265kB/s] 
Downloading (…)okenizer_config.json: 100%|██████████████████████████████████████████████████████████████████████| 737/737 [00:00<?, ?B/s] 
Downloading tokenizer/merges.txt: 100%|███████████████████████████████████████████████████████████████| 525k/525k [00:00<00:00, 7.77MB/s] 
Downloading unet/config.json: 100%|█████████████████████████████████████████████████████████████████| 1.87k/1.87k [00:00<00:00, 3.82MB/s] 
Downloading vae/config.json: 100%|██████████████████████████████████████████████████████████████████████████████| 756/756 [00:00<?, ?B/s] 
Downloading tokenizer/vocab.json: 100%|█████████████████████████████████████████████████████████████| 1.06M/1.06M [00:00<00:00, 7.48MB/s] 
Downloading (…)ch_model.safetensors: 100%|████████████████████████████████████████████████████████████| 335M/335M [00:19<00:00, 17.0MB/s] 
Downloading model.safetensors: 100%|██████████████████████████████████████████████████████████████████| 492M/492M [00:22<00:00, 22.2MB/s] 
Downloading (…)ch_model.safetensors: 100%|██████████████████████████████████████████████████████████| 3.44G/3.44G [01:16<00:00, 44.9MB/s] 
Fetching 14 files: 100%|█████████████████████████████████████████████████████████████████████████████████| 14/14 [01:17<00:00,  5.52s/it] 
Loading pipeline components...:  67%|██████████████████████████████████████████████▋                       | 4/6 [00:02<00:01,  1.73it/s]C:\Users\aaron\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\clip\feature_extraction_clip.py:28: FutureWarning: The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use CLIPImageProcessor instead.
  warnings.warn(
Loading pipeline components...: 100%|██████████████████████████████████████████████████████████████████████| 6/6 [00:02<00:00,  2.80it/s]
You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 .
The config attributes {'skip_prk_steps': True} were passed to LCMScheduler, but are not expected and will be ignored. Please verify your scheduler_config.json configuration file.
Downloading (…)_weights.safetensors: 100%|████████████████████████████████████████████████████████████| 135M/135M [00:03<00:00, 39.2MB/s]
C:\Users\aaron\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\blocks.py:891: UserWarning: api_name predict already exists, using predict_1
  warnings.warn(f"api_name {api_name} already exists, using {api_name_}")
C:\Users\aaron\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\blocks.py:891: UserWarning: api_name predict already exists, using predict_2
  warnings.warn(f"api_name {api_name} already exists, using {api_name_}")
C:\Users\aaron\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\blocks.py:891: UserWarning: api_name predict already exists, using predict_3
  warnings.warn(f"api_name {api_name} already exists, using {api_name_}")
C:\Users\aaron\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\blocks.py:891: UserWarning: api_name predict already exists, using predict_4
  warnings.warn(f"api_name {api_name} already exists, using {api_name_}")
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.

Testing Gradio on

Test gradio by launching the app. Test Results after a successful launch local:

image/png

models

None public yet

datasets

None public yet