Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor' torchvision 0.17 promblem #5108

Closed
1 task done
KEDI103 opened this issue Nov 16, 2023 · 19 comments · Fixed by #5690
Closed
1 task done
Labels
bug Something isn't working

Comments

@KEDI103
Copy link

KEDI103 commented Nov 16, 2023

Is there an existing issue for this?

  • I have searched the existing issues

OS

Linux

GPU

amd

VRAM

16

What version did you experience this issue on?

all version contain

What happened?


Generate images with a browser-based interface
2023-11-16 00:24:48.166525: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
[2023-11-16 00:24:52,684]::[InvokeAI]::INFO --> Loaded 0 modules from /media/b_cansin/ai/ai/InvokeAI-Installer/nodes
>> patchmatch.patch_match: INFO - Compiling and loading c extensions from "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/patchmatch".
>> patchmatch.patch_match: ERROR - patchmatch failed to load or compile (Command 'make clean && make' returned non-zero exit status 2.).
>> patchmatch.patch_match: INFO - Refer to https://invoke-ai.github.io/InvokeAI/installation/060_INSTALL_PATCHMATCH/ for installation instructions.
[2023-11-16 00:24:58,694]::[InvokeAI]::INFO --> Patchmatch not loaded (nonfatal)
Traceback (most recent call last):
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/bin/invokeai-web", line 5, in <module>
    from invokeai.app.api_app import invoke_api
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/invokeai/app/api_app.py", line 40, in <module>
    from .api.dependencies import ApiDependencies
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/invokeai/app/api/dependencies.py", line 10, in <module>
    from ..services.board_images.board_images_default import BoardImagesService
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/invokeai/app/services/board_images/board_images_default.py", line 3, in <module>
    from invokeai.app.services.invoker import Invoker
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/invokeai/app/services/invoker.py", line 7, in <module>
    from .shared.graph import Graph, GraphExecutionState
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/invokeai/app/services/shared/graph.py", line 12, in <module>
    from invokeai.app.invocations import *  # noqa: F401 F403
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/invokeai/app/invocations/upscale.py", line 8, in <module>
    from basicsr.archs.rrdbnet_arch import RRDBNet
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/basicsr/__init__.py", line 4, in <module>
    from .data import *
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/basicsr/data/__init__.py", line 22, in <module>
    _dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/basicsr/data/__init__.py", line 22, in <listcomp>
    _dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/basicsr/data/realesrgan_dataset.py", line 11, in <module>
    from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels
  File "/media/b_cansin/ai/ai/InvokeAI-Installer/.venv/lib/python3.10/site-packages/basicsr/data/degradations.py", line 8, in <module>
    from torchvision.transforms.functional_tensor import rgb_to_grayscale
ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'

Screenshots

No response

Additional context

The cure is:
AUTOMATIC1111/stable-diffusion-webui#13985 (comment)
I tested for AUTOMATIC1111 its working but for invokeai it hide venv folder and only accesable by dev console could be need bit help to edit it.
For real fix awaiting approval:
XPixelGroup/BasicSR#650

Contact Details

discord: b_cansin

@KEDI103 KEDI103 added the bug Something isn't working label Nov 16, 2023
@psychedelicious
Copy link
Collaborator

we've pinned torchvision to 0.16.0 which does not have this problem. will be in the next release, should fix this for you. hopefully the upstream PR gets merged.

@KEDI103
Copy link
Author

KEDI103 commented Nov 16, 2023

we've pinned torchvision to 0.16.0 which does not have this problem. will be in the next release, should fix this for you. hopefully the upstream PR gets merged.

I edited myself it fixed doing this
AUTOMATIC1111/stable-diffusion-webui#13985 (comment)
But I want to inform here too. I need torch 2.2 with torchvision 0.17 because of this
pytorch/pytorch#103973 (comment)

@psychedelicious
Copy link
Collaborator

psychedelicious commented Nov 16, 2023

@KEDI103 torch 2.2 doesn't exist. torch 2.1.0 is fine with torchvision 0.16.0.

While the fix you applied works, it's not a good way to fix this issue. If we end up needing torchvision 0.17.0, we can figure out a solution (possibly just a fork of basicsr with the fix)

@KEDI103
Copy link
Author

KEDI103 commented Nov 16, 2023

@KEDI103 torch 2.2 doesn't exist. torch 2.1.0 is fine with torchvision 0.16.0.

While the fix you applied works, it's not a good way to fix this issue. If we end up needing torchvision 0.17.0, we can figure out a solution (possibly just a fork of basicsr with the fix)

heres torch 2.2 also works with invokeai too
283430332-66ae618c-d132-43fc-b273-d1389d8dc96f

@psychedelicious
Copy link
Collaborator

psychedelicious commented Nov 16, 2023

the latest torch release is 2.1.1, just released yesterday

you appear to have a dev/nightly build of torch installed. invokeai doesn't use those.

@KEDI103
Copy link
Author

KEDI103 commented Nov 16, 2023

the latest torch release is 2.1.1, just released yesterday

you appear to have a dev/nightly build of torch installed. invokeai doesn't use those.

I have force to use it we got for months of test to deal with pci atomics problems for ROCM
pytorch/pytorch#103973 (comment)

Also can we got options in updater won't always force uninstall torch because it give me additional steps to delete and reinstall my forced torch versions.

@psychedelicious
Copy link
Collaborator

What kind of options do you need? Do you mean to install different versions of certain packages?

@KEDI103
Copy link
Author

KEDI103 commented Nov 17, 2023

What kind of options do you need? Do you mean to install different versions of certain packages?

I meant when I update invoke update detect my pytorch version and uninstall it everytime and reinstall the broken one for me. And I need to reinstall my needed pytorch version from dev console.

If there is option to keep the installed pytorch would be so awesome. It saves so much time for me.

@psychedelicious
Copy link
Collaborator

@lstein
There's an issue with rocm that is resolved on a dev release of PyTorch. @KEDI103 (and other users with certain gpus) will need to use 2.2dev (or whatever other build) along with torchvision 0.17.0.

Can we provide a special optional package group for this? Say, ".[rocm-fix]", something like that? I'm not sure how this stuff all interacts.

@KEDI103 which gpus are affected?

@fxzjshm
Copy link

fxzjshm commented Nov 17, 2023

Affected GPUs are gfx906 based GPUs with no PCIe atomics, e.g. Radeon VII, Instinct MI50, etc.

@KEDI103
Copy link
Author

KEDI103 commented Nov 17, 2023

Affected GPUs are gfx906 based GPUs with no PCIe atomics, e.g. Radeon VII, Instinct MI50, etc.

Actually this not gpu problem its pci atomics missing problem.

@KEDI103
Copy link
Author

KEDI103 commented Nov 17, 2023

@lstein There's an issue with rocm that is resolved on a dev release of PyTorch. @KEDI103 (and other users with certain gpus) will need to use 2.2dev (or whatever other build) along with torchvision 0.17.0.

Can we provide a special optional package group for this? Say, ".[rocm-fix]", something like that? I'm not sure how this stuff all interacts.

@KEDI103 which gpus are affected?

Next week nighty pre build will show us. Also It not gpu problem its motherboard+cpu missing pci atomics support.
pytorch/pytorch#103973 (comment)

@psychedelicious
Copy link
Collaborator

Ah, I see. Thanks for clarifying.

Do we have an ETA on torch 2.2.0?

@KEDI103
Copy link
Author

KEDI103 commented Nov 17, 2023

Ah, I see. Thanks for clarifying.

Do we have an ETA on torch 2.2.0?

well right now I gen at torch-2.2.0.dev20231114+rocm5.7-cp310-cp310-linux_x86_64 with torchvision-0.17.0+rocm5.7-cp310-cp310-linux_x86_64
If this going to merge with pre I think yes

@psychedelicious
Copy link
Collaborator

Sorry, what I meant is, do we know when torch 2.2.0 is expected to be released?

@KEDI103
Copy link
Author

KEDI103 commented Nov 17, 2023

Sorry, what I meant is, do we know when torch 2.2.0 is expected to be released?

Maybe next week because what I am using wheel gona merge with offical nighty pre build.

@psychedelicious
Copy link
Collaborator

Usually there are only a few torch minor version releases per year (they say 3 per year is typical). We just had 2.1.0 at the beginning of october, so I'd be surprised if we get 2.2.0 so soon after.

If we can just wait until torch 2.2.0 is released, that seems a lot simpler than updating the installation process with a new UI to install certain versions of things.

psychedelicious added a commit that referenced this issue Feb 10, 2024
`basicsr` has a hard dependency on torchvision <= 0.16 and is unmaintained. Extract the code we need from it and remove the dep.

Closes #5108
psychedelicious added a commit that referenced this issue Feb 10, 2024
`basicsr` has a hard dependency on torchvision <= 0.16 and is unmaintained. Extract the code we need from it and remove the dep.

Closes #5108
psychedelicious added a commit that referenced this issue Feb 10, 2024
`basicsr` has a hard dependency on torchvision <= 0.16 and is unmaintained. Extract the code we need from it and remove the dep.

Closes #5108
@ohmerhe
Copy link

ohmerhe commented Apr 28, 2024

Still have this issue in 2.2.2 on mac

Name: torch
Version: 2.2.2
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: /Users/ohmer/miniconda3/envs/MoneyPrinterTurbo/lib/python3.10/site-packages
Requires: filelock, fsspec, jinja2, networkx, sympy, typing-extensions
Required-by: basicsr, facexlib, gfpgan, realesrgan, torchaudio, torchvision

Name: torchvision
Version: 0.17.2
Summary: image and video datasets and models for torch deep learning
Home-page: https://github.com/pytorch/vision
Author: PyTorch Core Team
Author-email: soumith@pytorch.org
License: BSD
Location: /Users/ohmer/miniconda3/envs/MoneyPrinterTurbo/lib/python3.10/site-packages
Requires: numpy, pillow, torch
Required-by: basicsr, facexlib, gfpgan, realesrgan

@psychedelicious
Copy link
Collaborator

@ohmerhe You are on an old version. Please follow the instructions here to update: https://invoke-ai.github.io/InvokeAI/installation/010_INSTALL_AUTOMATED/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants