You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
在某些版本pytorch(2.2.1)中,torchvision.transforms.functional_tensor的名字改了,改成了torchvision.transforms._functional_tensor,导致data\degradations.py这个文件里面导入这个包时会出错,修改包名后可正常运行
In some versions of Pytorch (for example, 2.2.1), the name of the module "torchvision.transforms.functional_tensor" has been modified to "torchvision.transforms._functional_tensor", which would cause an error when import this module in the file "data\degradations.py". Editing the name of the module could solve this issue.
The text was updated successfully, but these errors were encountered:
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
在某些版本pytorch(2.2.1)中,torchvision.transforms.functional_tensor的名字改了,改成了torchvision.transforms._functional_tensor,导致data\degradations.py这个文件里面导入这个包时会出错,修改包名后可正常运行
In some versions of Pytorch (for example, 2.2.1), the name of the module "torchvision.transforms.functional_tensor" has been modified to "torchvision.transforms._functional_tensor", which would cause an error when import this module in the file "data\degradations.py". Editing the name of the module could solve this issue.
The text was updated successfully, but these errors were encountered: