Closed blazexpire closed 7 months ago
Hi,
This is because TorchDrug hacks the pytorch datasets' metaclass, which may lead to conflicts with datasets in torchvision. May I ask which version of esm
do you use? I use fair-esm=2.0.0
, which does not import torchvision and will not have this problem.
Another solution is to add from torchvision import datasets
before from torchdrug import core, models, tasks, datasets, utils
.
I've solved this problem by reinstall fair-esm
.
Thanks for all.
Thank you for your great work. However when try to pretrain,I encountered such error the same as a closed issue. python script/pretrain.py -c config/pretrain/mc_gearnet_edge.yaml --gpus [0] Traceback (most recent call last): File "script/pretrain.py", line 8, in
from torchdrug import core, models, tasks, datasets, utils
File "C:\Users\mercy\anaconda3\envs\proj_v1\lib\site-packages\torchdrug\models__init.py", line 10, in
from .esm import EvolutionaryScaleModeling
File "C:\Users\mercy\anaconda3\envs\proj_v1\lib\site-packages\torchdrug\models\esm.py", line 6, in
import esm
File "C:\Users\mercy\anaconda3\envs\proj_v1\lib\site-packages\esm__init__.py", line 8, in
from .data import Alphabet, RobertaAlphabet, BatchConverter, FastaBatchedDataset # noqa
File "C:\Users\mercy\anaconda3\envs\proj_v1\lib\site-packages\esm\data.py", line 11, in
from torchvision.datasets.utils import download_url
File "C:\Users\mercy\anaconda3\envs\proj_v1\lib\site-packages\torchvision__init__.py", line 5, in
from torchvision import datasets
File "C:\Users\mercy\anaconda3\envs\proj_v1\lib\site-packages\torchvision\datasets\ init__.py", line 1, in
from ._optical_flow import KittiFlow, Sintel, FlyingChairs, FlyingThings3D, HD1K
File "C:\Users\mercy\anaconda3\envs\proj_v1\lib\site-packages\torchvision\datasets_optical_flow.py", line 26, in
class FlowDataset(ABC, VisionDataset):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
My environment is about:
python 3.8.18
torch 1.12.1
torchdrug 0.2.1
torchvision 0.13.1
pyg 2.3.1
I've tried to reinstall torchdrug, but I have the same error.