TencentARC/GFPGAN

roop face enhancer is not working now

Opened this issue · 1 comments

No Module name from torchvision.transforms.functional_tensor import rgb_to_grayscale . I think this is the main error

For Google Colab just copy paste this stupid code and run

import requests
import sys
import shutil
def fix():
  url = "https://raw.githubusercontent.com/neuralfalcon/DreamTalk-Colab-Demo/main/degradations.py"
  filename = "/content/degradations.py"
  full_version = sys.version.split(' ')[0]
  major_minor_version = '.'.join(full_version.split('.')[:2])
  basicsr_path=f"/usr/local/lib/python{major_minor_version}/dist-packages/basicsr/data/degradations.py"
  # Send a GET request to the URL
  response = requests.get(url)
  # Check if the request was successful (status code 200)
  if response.status_code == 200:
      # Write the content to a file
      with open(filename, 'wb') as file:
          file.write(response.content)
      try:
        shutil.copy("/content/degradations.py",basicsr_path)
        print(f"Copied to {basicsr_path}")
      except:
        print("Update the 'basicsr_path' variable -- replace '{major_minor_version}' with the current Python version in Google Colab, such as 3.10.")

  else:
      print("Failed to download the file.")
fix()

For Windows or Mac

Find python install folder then Follow the path and find degradations.py like
D:/python3.10/dist-packages/basicsr/data/degradations.py

update the line:

from torchvision.transforms.functional_tensor import rgb_to_grayscale

to:

from torchvision.transforms.functional import rgb_to_grayscale