Skip to content

RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (CPU) #16

@coconut0012

Description

@coconut0012

Hi, I run the gradio demo on both 4090 and A100. Both machines will encounter this error. Is there any solution for this?

  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/gradio/routes.py", line 523, in run_predict
    output = await app.get_blocks().process_api(
  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/gradio/blocks.py", line 1437, in process_api
    result = await self.call_function(
  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/gradio/blocks.py", line 1109, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
    return await future
  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 962, in run
    result = context.run(func, *args)
  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/gradio/utils.py", line 865, in wrapper
    response = f(*args, **kwargs)
  File "/server/AnyV2V/gradio_demo.py", line 295, in btn_infer_fn
    result_video_path = AnyV2V_Editor.perform_anyv2v(video_path=video_path,
  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/server/AnyV2V/gradio_demo.py", line 140, in perform_anyv2v
    _ddim_latents = ddim_inversion(
  File "/server/AnyV2V/i2vgen-xl/run_group_ddim_inversion.py", line 37, in ddim_inversion
    ddim_latents = pipe.invert(
  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/server/AnyV2V/i2vgen-xl/pipelines/pipeline_i2vgen_xl.py", line 1418, in invert
    latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).prev_sample
  File "/server/miniconda3/envs/anyv2v/lib/python3.10/site-packages/diffusers/schedulers/scheduling_ddim_inverse.py", line 337, in step
    alpha_prod_t = self.alphas_cumprod[timestep] if timestep >= 0 else self.initial_alpha_cumprod
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (CPU)

Conda environment:

name: anyv2v
channels:
  - pytorch
  - nvidia
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=2_gnu
  - aom=3.9.1=hac33072_0
  - blas=1.0=mkl
  - brotli-python=1.1.0=py310hf71b8c6_2
  - bzip2=1.0.8=h4bc722e_7
  - ca-certificates=2024.12.14=hbcca054_0
  - cairo=1.18.2=h3394656_1
  - certifi=2024.12.14=pyhd8ed1ab_0
  - cffi=1.17.1=py310h8deb56e_0
  - charset-normalizer=3.4.1=pyhd8ed1ab_0
  - cpython=3.10.16=py310hd8ed1ab_1
  - cuda-cudart=11.8.89=0
  - cuda-cupti=11.8.87=0
  - cuda-libraries=11.8.0=0
  - cuda-nvrtc=11.8.89=0
  - cuda-nvtx=11.8.86=0
  - cuda-runtime=11.8.0=0
  - cuda-version=12.6=3
  - dav1d=1.2.1=hd590300_0
  - ffmpeg=7.1.0=gpl_h5eeeb2e_109
  - filelock=3.16.1=pyhd8ed1ab_1
  - font-ttf-dejavu-sans-mono=2.37=hab24e00_0
  - font-ttf-inconsolata=3.000=h77eed37_0
  - font-ttf-source-code-pro=2.038=h77eed37_0
  - font-ttf-ubuntu=0.83=h77eed37_3
  - fontconfig=2.15.0=h7e30c49_1
  - fonts-conda-ecosystem=1=0
  - fonts-conda-forge=1=0
  - freetype=2.12.1=h267a509_2
  - fribidi=1.0.10=h36c2ea0_0
  - gdk-pixbuf=2.42.12=hb9ae30d_0
  - gmp=6.3.0=hac33072_2
  - gmpy2=2.1.5=py310he8512ff_3
  - graphite2=1.3.13=h59595ed_1003
  - h2=4.1.0=pyhd8ed1ab_1
  - harfbuzz=10.1.0=h0b3b770_0
  - hpack=4.0.0=pyhd8ed1ab_1
  - hyperframe=6.0.1=pyhd8ed1ab_1
  - icu=75.1=he02047a_0
  - idna=3.10=pyhd8ed1ab_1
  - intel-openmp=2022.0.1=h06a4308_3633
  - jinja2=3.1.5=pyhd8ed1ab_0
  - lame=3.100=h166bdaf_1003
  - lcms2=2.16=hb7c19ff_0
  - ld_impl_linux-64=2.43=h712a8e2_2
  - lerc=4.0.0=h27087fc_0
  - level-zero=1.19.2=h84d6215_1
  - libabseil=20240722.0=cxx17_hbbce691_4
  - libass=0.17.3=hba53ac1_1
  - libblas=3.9.0=16_linux64_mkl
  - libcblas=3.9.0=16_linux64_mkl
  - libcublas=11.11.3.6=0
  - libcufft=10.9.0.58=0
  - libcufile=1.11.1.6=0
  - libcurand=10.3.7.77=0
  - libcusolver=11.4.1.48=0
  - libcusparse=11.7.5.86=0
  - libdeflate=1.23=h4ddbbb0_0
  - libdrm=2.4.124=hb9d3cd8_0
  - libegl=1.7.0=ha4b6fd6_2
  - libexpat=2.6.4=h5888daf_0
  - libffi=3.4.2=h7f98852_5
  - libgcc=14.2.0=h77fa898_1
  - libgcc-ng=14.2.0=h69a702a_1
  - libgl=1.7.0=ha4b6fd6_2
  - libglib=2.82.2=h2ff4ddf_0
  - libglvnd=1.7.0=ha4b6fd6_2
  - libglx=1.7.0=ha4b6fd6_2
  - libgomp=14.2.0=h77fa898_1
  - libhwloc=2.11.2=default_h0d58e46_1001
  - libiconv=1.17=hd590300_2
  - libjpeg-turbo=3.0.0=hd590300_1
  - liblapack=3.9.0=16_linux64_mkl
  - liblzma=5.6.3=hb9d3cd8_1
  - libnpp=11.8.0.86=0
  - libnsl=2.0.1=hd590300_0
  - libnvjpeg=11.9.0.86=0
  - libopenvino=2024.6.0=hac27bb2_3
  - libopenvino-auto-batch-plugin=2024.6.0=h4d9b6c2_3
  - libopenvino-auto-plugin=2024.6.0=h4d9b6c2_3
  - libopenvino-hetero-plugin=2024.6.0=h3f63f65_3
  - libopenvino-intel-cpu-plugin=2024.6.0=hac27bb2_3
  - libopenvino-intel-gpu-plugin=2024.6.0=hac27bb2_3
  - libopenvino-intel-npu-plugin=2024.6.0=hac27bb2_3
  - libopenvino-ir-frontend=2024.6.0=h3f63f65_3
  - libopenvino-onnx-frontend=2024.6.0=h6363af5_3
  - libopenvino-paddle-frontend=2024.6.0=h6363af5_3
  - libopenvino-pytorch-frontend=2024.6.0=h5888daf_3
  - libopenvino-tensorflow-frontend=2024.6.0=h630ec5c_3
  - libopenvino-tensorflow-lite-frontend=2024.6.0=h5888daf_3
  - libopus=1.3.1=h7f98852_1
  - libpciaccess=0.18=hd590300_0
  - libpng=1.6.44=hadc24fc_0
  - libprotobuf=5.28.3=h6128344_1
  - librsvg=2.58.4=h49af25d_2
  - libsqlite=3.47.2=hee588c1_0
  - libstdcxx=14.2.0=hc0a3c3a_1
  - libstdcxx-ng=14.2.0=h4852527_1
  - libtiff=4.7.0=hd9ff511_3
  - libuuid=2.38.1=h0b41bf4_0
  - libva=2.22.0=h8a09558_1
  - libvpx=1.14.1=hac33072_0
  - libwebp-base=1.5.0=h851e524_0
  - libxcb=1.17.0=h8a09558_0
  - libxcrypt=4.4.36=hd590300_1
  - libxml2=2.13.5=h8d12d68_1
  - libzlib=1.3.1=hb9d3cd8_2
  - llvm-openmp=15.0.7=h0cdce71_0
  - mkl=2022.1.0=hc2b9512_224
  - mpc=1.3.1=h24ddda3_1
  - mpfr=4.2.1=h90cbb55_3
  - mpmath=1.3.0=pyhd8ed1ab_1
  - ncurses=6.5=he02047a_1
  - networkx=3.4.2=pyh267e887_2
  - ocl-icd=2.3.2=hb9d3cd8_2
  - opencl-headers=2024.10.24=h5888daf_0
  - openh264=2.5.0=hf92e6e3_0
  - openjpeg=2.5.3=h5fbd93e_0
  - openssl=3.4.0=h7b32b05_1
  - pango=1.54.0=h861ebed_4
  - pcre2=10.44=hba22ea6_2
  - pip=24.3.1=pyh8b19718_2
  - pixman=0.44.2=h29eaf8c_0
  - pthread-stubs=0.4=hb9d3cd8_1002
  - pugixml=1.14=h59595ed_0
  - pycparser=2.22=pyh29332c3_1
  - pysocks=1.7.1=pyha55dd90_7
  - python=3.10.16=he725a3c_1_cpython
  - python_abi=3.10=5_cp310
  - pytorch=2.1.0=py3.10_cuda11.8_cudnn8.7.0_0
  - pytorch-cuda=11.8=h7e8668a_6
  - pytorch-mutex=1.0=cuda
  - pyyaml=6.0.2=py310ha75aee5_1
  - readline=8.2=h8228510_1
  - requests=2.32.3=pyhd8ed1ab_1
  - setuptools=75.6.0=pyhff2d567_1
  - snappy=1.2.1=h8bd8927_1
  - svt-av1=2.3.0=h5888daf_0
  - sympy=1.13.3=pyh2585a3b_104
  - tbb=2022.0.0=hceb3a55_0
  - tk=8.6.13=noxft_h4845f30_101
  - torchaudio=2.1.0=py310_cu118
  - torchtriton=2.1.0=py310
  - torchvision=0.16.0=py310_cu118
  - typing_extensions=4.12.2=pyha770c72_1
  - urllib3=2.3.0=pyhd8ed1ab_0
  - wayland=1.23.1=h3e06ad9_0
  - wayland-protocols=1.37=hd8ed1ab_0
  - wheel=0.45.1=pyhd8ed1ab_1
  - x264=1!164.3095=h166bdaf_2
  - x265=3.5=h924138e_3
  - xorg-libice=1.1.2=hb9d3cd8_0
  - xorg-libsm=1.2.5=he73a12e_0
  - xorg-libx11=1.8.10=h4f16b4b_1
  - xorg-libxau=1.0.12=hb9d3cd8_0
  - xorg-libxdmcp=1.1.5=hb9d3cd8_0
  - xorg-libxext=1.3.6=hb9d3cd8_0
  - xorg-libxfixes=6.0.1=hb9d3cd8_0
  - xorg-libxrender=0.9.12=hb9d3cd8_0
  - yaml=0.2.5=h7f98852_2
  - zstandard=0.23.0=py310ha39cb0e_1
  - zstd=1.5.6=ha6fb4c9_0
  - pip:
      - accelerate==0.23.0
      - aiofiles==23.2.1
      - altair==5.5.0
      - annotated-types==0.7.0
      - antlr4-python3-runtime==4.9.3
      - anyio==4.8.0
      - attrs==24.3.0
      - av==14.0.1
      - click==8.1.8
      - contourpy==1.3.1
      - cycler==0.12.1
      - decorator==4.4.2
      - decord==0.6.0
      - diffusers==0.26.3
      - docker-pycreds==0.4.0
      - einops==0.8.0
      - exceptiongroup==1.2.2
      - fastapi==0.115.6
      - ffmpy==0.5.0
      - fonttools==4.55.3
      - fsspec==2024.12.0
      - gitdb==4.0.12
      - gitpython==3.1.44
      - gradio==3.42.0
      - gradio-client==0.5.0
      - h11==0.14.0
      - httpcore==1.0.7
      - httpx==0.28.1
      - huggingface-hub==0.27.1
      - imageio==2.27.0
      - imageio-ffmpeg==0.5.1
      - importlib-metadata==8.5.0
      - importlib-resources==6.5.2
      - joblib==1.4.2
      - jsonschema==4.23.0
      - jsonschema-specifications==2024.10.1
      - kiwisolver==1.4.8
      - lightning-utilities==0.11.9
      - markupsafe==2.1.5
      - matplotlib==3.10.0
      - moviepy==1.0.3
      - narwhals==1.21.0
      - numpy==1.26.4
      - omegaconf==2.3.0
      - orjson==3.10.13
      - packaging==24.2
      - pandas==2.2.3
      - pillow==9.5.0
      - platformdirs==4.3.6
      - proglog==0.1.10
      - protobuf==5.29.2
      - psutil==6.1.1
      - pydantic==2.10.4
      - pydantic-core==2.27.2
      - pydub==0.25.1
      - pyparsing==3.2.1
      - python-dateutil==2.9.0.post0
      - python-dotenv==1.0.1
      - python-multipart==0.0.20
      - pytz==2024.2
      - referencing==0.35.1
      - regex==2024.11.6
      - rotary-embedding-torch==0.8.6
      - rpds-py==0.22.3
      - safetensors==0.5.0
      - scikit-learn==1.6.0
      - scipy==1.15.0
      - semantic-version==2.10.0
      - sentry-sdk==2.19.2
      - setproctitle==1.3.4
      - six==1.17.0
      - smmap==5.0.2
      - sniffio==1.3.1
      - starlette==0.41.3
      - threadpoolctl==3.5.0
      - tokenizers==0.13.3
      - torch-fidelity==0.3.0
      - torchmetrics==1.6.1
      - tqdm==4.67.1
      - transformers==4.28.0
      - tzdata==2024.2
      - uvicorn==0.34.0
      - wandb==0.19.1
      - websockets==11.0.3
      - zipp==3.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions