Scene-Graph-Benchmark.pytorch
Scene-Graph-Benchmark.pytorch copied to clipboard
AttributeError: module 'torchvision' has no attribute 'datasets'
❓ Questions and Help
hello, thank you for the great job.
when i run the command bash train.sh Language_VG_Uniter
a problem happened below:
Traceback (most recent call last):
File "tools/relation_train_net.py", line 19, in <module>
from maskrcnn_benchmark.data import make_data_loader
File "/home/liujingwei/icme/sgg_from_nls/maskrcnn_benchmark/data/__init__.py", line 2, in <module>
from .build import make_data_loader, get_dataset_statistics
File "/home/liujingwei/icme/sgg_from_nls/maskrcnn_benchmark/data/build.py", line 14, in <module>
from . import datasets as D
File "/home/liujingwei/icme/sgg_from_nls/maskrcnn_benchmark/data/datasets/__init__.py", line 2, in <module>
from .coco import COCODataset
File "/home/liujingwei/icme/sgg_from_nls/maskrcnn_benchmark/data/datasets/coco.py", line 39, in <module>
class COCODataset(torchvision.datasets.coco.CocoDetection):
AttributeError: module 'torchvision' has no attribute 'datasets'
I dont know if the torchvision is wrong or something happened.
Hi, have you managed to fix this problem? I have the same issue here.
I have the same problem, did you find a solution?
I have the same problem, I had tried many versions of torchvisions, but the problem remains. Did you find a solution?
I solved this problem, first by having the right torch, torchvision and torch audio. Then the mistake I made is to put all repos in one folder which created some sort of conflict. So make sure that apex and cocoapi are cloned in different folder than scene graph.
I solved this problem, first by having the right torch, torchvision and torch audio. Then the mistake I made is to put all repos in one folder which created some sort of conflict. So make sure that apex and cocoapi are cloned in different folder than scene graph.
Can you tell me more about how you solved it
I solved this problem, in the file https://github.com/KaihuaTang/Scene-Graph-Benchmark.pytorch/blob/master/INSTALL.md,the author wrote down this code
# install PyTorch Detection
cd $INSTALL_DIR
git clone https://github.com/KaihuaTang/Scene-Graph-Benchmark.pytorch.git
cd scene-graph-benchmark
# the following will install the lib with
# symbolic links, so that you can modify
# the files if you want and won't need to
# re-build it
python setup.py build develop
However, I misunderstood it. I mistakenly thought that it didn't matter to the project whether or not to run the code python setup.py build develop
.
So, if you meet the problem "AttributeError: module 'torchvision' has no attribute 'datasets'" , just don't forget to run this code python setup.py build develop
and you will solve it.
Also, if you change GPU after you build this project ,you need to delete the directory build
and file maskrcnn_benchmark/***.so
, and then re-build it to develop these files.
By the way, I also sovled a problem I met. The problem is "ImportError: cannot import name 'amp' from 'apex' (unknown location)" , you can follow this guide https://stackoverflow.com/questions/70547501/importerror-cannot-import-name-amp-from-apex-unknown-location-jupyter-la to solve this problem I mentioned.
Recently I have the same problem. I have tried the methods mentioned above and still cannot solve it. It seems that the codes import the wrong torchvision package: <module 'torchvision' from '/home/xxx/.cache/torch_extensions/py39_cu116/torchvision/torchvision.so'>. Could someone share some useful solutions? I would deeply appreciate it.
Recently I have the same problem. I have tried the methods mentioned above and still cannot solve it. It seems that the codes import the wrong torchvision package: <module 'torchvision' from '/home/xxx/.cache/torch_extensions/py39_cu116/torchvision/torchvision.so'>. Could someone share some useful solutions? I would deeply appreciate it.
hi, I have met the same problem. Have you solved it?
I solved this problem, in the file https://github.com/KaihuaTang/Scene-Graph-Benchmark.pytorch/blob/master/INSTALL.md,the author wrote down this code
# install PyTorch Detection cd $INSTALL_DIR git clone https://github.com/KaihuaTang/Scene-Graph-Benchmark.pytorch.git cd scene-graph-benchmark # the following will install the lib with # symbolic links, so that you can modify # the files if you want and won't need to # re-build it python setup.py build develop
However, I misunderstood it. I mistakenly thought that it didn't matter to the project whether or not to run the code
python setup.py build develop
.So, if you meet the problem "AttributeError: module 'torchvision' has no attribute 'datasets'" , just don't forget to run this code
python setup.py build develop
and you will solve it.Also, if you change GPU after you build this project ,you need to delete the directory
build
and filemaskrcnn_benchmark/***.so
, and then re-build it to develop these files.By the way, I also sovled a problem I met. The problem is "ImportError: cannot import name 'amp' from 'apex' (unknown location)" , you can follow this guide https://stackoverflow.com/questions/70547501/importerror-cannot-import-name-amp-from-apex-unknown-location-jupyter-la to solve this problem I mentioned.
I did this, but the problem still happened. This made me crazy.