CUDA out of memory

Author: MangorayCreated Mar 2, 2021Updated Oct 11, 2025
Labelsbug

Describe the bug

  • when running run_windows.bat, loading predictor comes up
  • cam window appears
  • after pressing 'X', a grey avatarify window pops up , then the program crashes with the following error in miniconda:
C:\Users\raymo\miniconda3\envs\avatarify\lib\site-packages\torch\nn\functional.py:3385: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.

  warnings.warn("Default grid_sample and affine_grid behavior has changed "

Traceback (most recent call last):
  File "afy/cam_fomm.py", line 316, in <module>
    out = predictor.predict(frame)
  File "C:\Users\raymo\avatarify\afy\predictor_local.py", line 106, in predict
    out = self.generator(self.source, kp_source=self.kp_source, kp_driving=kp_norm)
  File "C:\Users\raymo\miniconda3\envs\avatarify\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\raymo\avatarify\fomm\modules\generator_optim.py", line 100, in forward
    out = self.up_blocks[i](out)
  File "C:\Users\raymo\miniconda3\envs\avatarify\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\raymo\avatarify\fomm\modules\\\util.py", line 91, in forward
    out = self.conv(out)
  File "C:\Users\raymo\miniconda3\envs\avatarify\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\raymo\miniconda3\envs\avatarify\lib\site-packages\torch\nn\modules\conv.py", line 423, in forward
    return self._conv_forward(input, self.weight)
  File "C:\Users\raymo\miniconda3\envs\avatarify\lib\site-packages\torch\nn\modules\conv.py", line 420, in _conv_forward
    self.padding, self.dilation, self.groups)
RuntimeError: CUDA out of memory. Tried to allocate 16.25 GiB (GPU 0; 24.00 GiB total capacity; 658.98 MiB already allocated; 17.02 GiB free; 4.53 GiB reserved in total by PyTorch)

Info (please complete the following information):

  • OS Windows 10 version 20H2, OS Build19042.804

  • GPU model: NVIDIA GeForce RTX 3090

  • Any other relevant information: Conda Info:

     active environment : avatarify
    active env location : C:\Users\raymo\miniconda3\envs\avatarify
            shell level : 2
       user config file : C:\Users\raymo\.condarc
 populated config files :
          conda version : 4.9.2
    conda-build version : not installed
         python version : 3.8.5.final.0
       virtual packages : __cuda=11.2=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Users\raymo\miniconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\raymo\miniconda3\pkgs
                          C:\Users\raymo\.conda\pkgs
                          C:\Users\raymo\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\raymo\miniconda3\envs
                          C:\Users\raymo\.conda\envs
                          C:\Users\raymo\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.9.2 requests/2.24.0 CPython/3.8.5 Windows/10 Windows/10.0.19041
          administrator : True
             netrc file : None
           offline mode : False

Conda list:

# packages in environment at C:\Users\raymo\miniconda3\envs\avatarify:
#
# Name                    Version                   Build  Channel
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
blas                      1.0                         mkl
blosc                     1.21.0               h0e60522_0    conda-forge
brotli                    1.0.9                h0e60522_4    conda-forge
brotlipy                  0.7.0           py37hcc03f2d_1001    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2020.10.14                    0    anaconda
certifi                   2020.6.20                py37_0    anaconda
cffi                      1.14.5           py37hd8e9650_0    conda-forge
chardet                   4.0.0            py37h03978a9_1    conda-forge
charls                    2.2.0                h39d44d4_0    conda-forge
cloudpickle               1.6.0                      py_0    conda-forge
cryptography              3.4.4            py37h65266a2_0    conda-forge
cudatoolkit               11.0.221             h74a9793_0
cycler                    0.10.0                     py_2    conda-forge
cytoolz                   0.11.0           py37hcc03f2d_3    conda-forge
dask-core                 2021.2.0           pyhd8ed1ab_0    conda-forge
decorator                 4.4.2                      py_0    conda-forge
face-alignment            1.3.3                    pypi_0    pypi
freetype                  2.10.4               h546665d_1    conda-forge
giflib                    5.2.1                h8d14728_2    conda-forge
git                       2.23.0               h6bb4b03_0    anaconda
idna                      2.10               pyh9f0ad1d_0    conda-forge
imagecodecs               2021.1.28        py37hb664a41_0    conda-forge
imageio                   2.9.0                      py_0    conda-forge
intel-openmp              2020.3             h57928b3_311    conda-forge
jpeg                      9d                   h8ffe710_0    conda-forge
jxrlib                    1.1                  h8ffe710_2    conda-forge
kiwisolver                1.3.1            py37h8c56517_1    conda-forge
lcms2                     2.12                 h2a16943_0    conda-forge
lerc                      2.2.1                h0e60522_0    conda-forge
libaec                    1.0.4                h39d44d4_1    conda-forge
libblas                   3.9.0                     8_mkl    conda-forge
libcblas                  3.9.0                     8_mkl    conda-forge
libdeflate                1.7                  h8ffe710_5    conda-forge
liblapack                 3.9.0                     8_mkl    conda-forge
libpng                    1.6.37               h1d00b33_2    conda-forge
libtiff                   4.2.0                hc10be44_0    conda-forge
libuv                     1.40.0               he774522_0
libwebp-base              1.2.0                h8ffe710_0    conda-forge
libzopfli                 1.0.3                h0e60522_0    conda-forge
llvmlite                  0.35.0                   pypi_0    pypi
lz4-c                     1.9.3                h8ffe710_0    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
matplotlib-base           3.3.4            py37h3379fd5_0    conda-forge
mkl                       2020.4             hb70f87d_311    conda-forge
msgpack                   1.0.2                    pypi_0    pypi
msgpack-numpy             0.4.7.1                  pypi_0    pypi
msys2-conda-epoch         20160418                      1    conda-forge
networkx                  2.5                        py_0    conda-forge
ninja                     1.10.2           py37h6d14046_0
numba                     0.52.0                   pypi_0    pypi
numpy                     1.19.0           py37hae9e721_0    conda-forge
olefile                   0.46               pyh9f0ad1d_1    conda-forge
opencv-python             4.2.0.34                 pypi_0    pypi
openjpeg                  2.4.0                h48faf41_0    conda-forge
openssl                   1.1.1j               h2bbff1b_0
packaging                 20.9               pyh44b312d_0    conda-forge
pillow                    8.1.0            py37h96663a1_2    conda-forge
pip                       21.0.1           py37haa95532_0
pooch                     1.3.0              pyhd8ed1ab_0    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pyfakewebcam              0.1.0                    pypi_0    pypi
pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pysocks                   1.7.1            py37h03978a9_3    conda-forge
python                    3.7.10               h6244533_0
python-blosc              1.7.0           py37h6538335_1001    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
pytorch                   1.7.1           py3.7_cuda110_cudnn8_0    pytorch
pywavelets                1.1.1            py37hda49f71_3    conda-forge
pyyaml                    5.3.1                    pypi_0    pypi
pyzmq                     20.0.0                   pypi_0    pypi
requests                  2.25.1             pyhd3deb0d_0    conda-forge
scikit-image              0.18.1           py37h08fd248_0    conda-forge
scipy                     1.6.0            py37h6db1a17_0    conda-forge
setuptools                52.0.0           py37haa95532_0
six                       1.15.0             pyh9f0ad1d_0    conda-forge
snappy                    1.1.8                ha925a31_3    conda-forge
sqlite                    3.33.0               h2a8f88b_0
tifffile                  2021.2.26          pyhd8ed1ab_0    conda-forge
tk                        8.6.10               h8ffe710_1    conda-forge
toolz                     0.11.1                     py_0    conda-forge
torchvision               0.2.2                      py_3    pytorch
tornado                   6.1              py37hcc03f2d_1    conda-forge
tqdm                      4.58.0                   pypi_0    pypi
typing_extensions         3.7.4.3            pyha847dfd_0
urllib3                   1.26.3             pyhd8ed1ab_0    conda-forge
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.36.2             pyhd3eb1b0_0
win_inet_pton             1.1.0            py37h03978a9_2    conda-forge
wincertstore              0.2                      py37_0
xz                        5.2.5                h62dcd97_1    conda-forge
yaml                      0.2.5                he774522_0    conda-forge
zfp                       0.5.5                h0e60522_4    conda-forge
zlib                      1.2.11               h62dcd97_4
zstd                      1.4.8                h4e2f164_1    conda-forge

:: Environment info

CONDA_DEFAULT_ENV=avatarify
CONDA_ENV_NAME=avatarify
CONDA_EXE=C:\Users\raymo\miniconda3\condabin\..\Scripts\conda.exe
CONDA_PREFIX=C:\Users\raymo\miniconda3\envs\avatarify
CONDA_PREFIX_1=C:\Users\raymo\miniconda3
CONDA_PROMPT_MODIFIER=(avatarify)
CONDA_PYTHON_EXE=C:\Users\raymo\miniconda3\python.exe
CONDA_SHLVL=2
PYTHONPATH=;C:\Users\raymo\avatarify;C:\Users\raymo\avatarify/fomm;C:\Users\raymo\avatarify;C:\Users\raymo\avatarify/fomm;C:\Users\raymo\avatarify;C:\Users\raymo\avatarify/fomm;C:\Users\raymo\avatarify;C:\Users\raymo\avatarify/fomm