gpt4 book ai didi

python - "AttributeError: Caught AttributeError in DataLoader worker process 0","AttributeError: module ' torchvision.transforms ' has no attribute ' 比例 '"

转载 作者:行者123 更新时间:2023-12-03 08:06:49 32 4
gpt4 key购买 nike

我遇到了这两个错误,“AttributeError:在 DataLoader 工作进程 0 中捕获 AttributeError”,“AttributeError:模块“torchvision.transforms”没有属性“Scale””

任何机构都可以帮忙吗? TIA

Traceback (most recent call last):
File "test.py", line 126, in <module>
main()
File "test.py", line 85, in main
for i, data in enumerate(dataset):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 530, in __next__
data = self._next_data()
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1224, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1250, in _process_data
data.reraise()
File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 457, in reraise
raise exception
AttributeError: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/ACGPN/data/aligned_dataset.py", line 133, in __getitem__
self.opt, params, method=Image.NEAREST, normalize=False)
File "/content/ACGPN/data/base_dataset.py", line 46, in get_transform
transform_list.append(transforms.Scale(osize, method))
AttributeError: module 'torchvision.transforms' has no attribute 'Scale'

最佳答案

如果没有看到任何代码,基本上不可能提供帮助,但是错误提示找不到 torchvision.transforms.Scale,因为它是 deprecated因此请使用torchvision.transforms.Resize

关于python - "AttributeError: Caught AttributeError in DataLoader worker process 0","AttributeError: module ' torchvision.transforms ' has no attribute ' 比例 '",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72073007/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com