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

when i do try restored image then in inference became like this. how do i fix this? thank you #4536

Closed
joey4411 opened this issue Apr 29, 2024 · 4 comments
Labels

Comments

@joey4411
Copy link

when i do try restored image then in inference became like this. how do i fix this? thank you
Capture

@joey4411 joey4411 added the bug label Apr 29, 2024
@cperry-goog
Copy link

We'll need a minimal reproducible notebook to investigate, or contact the original notebook author.

@cperry-goog
Copy link

Okay a bit more info after one of our eng looked (thanks!)

It looks like you're following this notebook, but the torchvision api has been deprecated. The correct issue to upvote is here: TencentARC/GFPGAN#539

In the meantime you can clone the repo and change the code as described here: AUTOMATIC1111/stable-diffusion-webui#13985 (comment)

As this does not appear to be a Colab issue, I'm closing this.

@shishirahm3d
Copy link

@joey4411 run this code on colab before running 3. Inference. it will replace the degradation.py line 8
from torchvision.transforms.functional_tensor import rgb_to_grayscale
to:
from torchvision.transforms.functional import rgb_to_grayscale

then you're good to go...

# Define the file path
file_path = '/usr/local/lib/python3.10/dist-packages/basicsr/data/degradations.py'

# Define the new import statement
new_import_statement = "from torchvision.transforms.functional import rgb_to_grayscale\n"

# Read the content of the file
with open(file_path, 'r') as file:
    lines = file.readlines()

# Modify the desired line (line 8 in this case)
if len(lines) >= 8:
    lines[7] = new_import_statement  # Index 7 corresponds to line 8 (0-based indexing)

# Write the modified content back to the file
with open(file_path, 'w') as file:
    file.writelines(lines)

print("Replacement completed successfully!")

@joey4411
Copy link
Author

thanks a lot it fixed now 👍

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

No branches or pull requests

3 participants