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

[BREAKING FIX] [torchvision 0.17] Change functional_tensor import #650

Merged
merged 1 commit into from
May 17, 2024

Conversation

TornjV
Copy link
Contributor

@TornjV TornjV commented Nov 16, 2023

Fix for #649

@@ -5,7 +5,7 @@
import torch
from scipy import special
from scipy.stats import multivariate_normal
from torchvision.transforms.functional_tensor import rgb_to_grayscale
from torchvision.transforms.functional import rgb_to_grayscale
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not be a breaking change if you try both imports:

Suggested change
from torchvision.transforms.functional import rgb_to_grayscale
try:
from torchvision.transforms.functional import rgb_to_grayscale
except ImportError:
from torchvision.transforms.functional_tensor import rgb_to_grayscale

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will work--
try:
from torchvision.transforms.functional import rgb_to_grayscale
except ImportError:
from torchvision.transforms.functional_tensor import rgb_to_grayscale

@psychedelicious
Copy link

torchvision 0.17 was just released: https://github.com/pytorch/vision/releases/tag/v0.17.0

@keepdying
Copy link

can we merge it? 2 months since 0.17 released.

@psychedelicious
Copy link

Over at Invoke, we only use the RealESRGAN functionality provided by basicsr.

I extracted the relevant classes and cleaned them up a bit:

Maybe this is useful for others who only use this library for upscaling and would like to keep their other dependencies up to date.

@akx
Copy link

akx commented Apr 2, 2024

Over at Invoke, we only use the RealESRGAN functionality provided by basicsr.

The Spandrel project by the chaiNNer folks (disclaimer: I'm a contributor, and I also wired Spandrel up into a1111 in AUTOMATIC1111/stable-diffusion-webui#14425) implements RealESRGAN and various other upscaling and enhancement models in a clean way.

@psychedelicious
Copy link

Thanks for the link @akx ! This looks like a very ergonomic API, great work. Much nicer than what the basicsr repo provides (and my extracted version of it).

@xinntao xinntao merged commit 8d56e3a into XPixelGroup:master May 17, 2024
makarovartyom added a commit to datacrunch-research/BasicSR that referenced this pull request May 17, 2024
change functional_tensor to functional (XPixelGroup#650)
@yulin-li
Copy link

could we release a new version with this fix?

@blucz
Copy link

blucz commented Oct 1, 2024

This bug continues to cause many users of downstream packages to manually hack up the basicsr code to get things to run, despite being fixed inmaster for nearly six months.

Is it possible for whoever controls the PyPI packaging to push the build button and release a new version?

@n0kovo
Copy link

n0kovo commented Nov 12, 2024

@xinntao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants