nerdyrodent / VQGAN-CLIP

Just playing with getting VQGAN+CLIP running locally, rather than having to use colab.
Other
2.59k stars 428 forks source link

ModuleNotFoundError: No module named 'torch._six' #170

Closed MjdMahasneh closed 2 months ago

MjdMahasneh commented 2 months ago

Error message:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-7-1e2e05b2fc88> in <cell line: 13>()
     11 from omegaconf import OmegaConf
     12 from PIL import Image
---> 13 from taming.models import cond_transformer, vqgan
     14 import taming.modules
     15 import torch

2 frames
/content/taming-transformers/taming/data/utils.py in <module>
      9 import torch
     10 from taming.data.helper_types import Annotation
---> 11 from torch._six import string_classes
     12 from torch.utils.data._utils.collate import np_str_obj_array_pattern, default_collate_err_msg_format
     13 from tqdm import tqdm

ModuleNotFoundError: No module named 'torch._six'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
MjdMahasneh commented 2 months ago

To address the ModuleNotFoundError in your Google Colab code for the taming-transformers library I updated the problematic import to ensure compatibility with current PyTorch installation:

Install the six library !pip install six

In the /content/taming-transformers/taming/data/utils.py file or wherever the error occurs, replace: from torch._six import string_classes with: from six import string_types as string_classes

This solved it for me using Google Collab, hope this helps.