Skip to content

Commit

Permalink
https://github.com/CompVis/taming-transformers/pull/200
Browse files Browse the repository at this point in the history
Remove reference to deprecated feature
torch._six has been deprecated, and this reference causes the code to not run. I removed the import and replaced the string_classes comparison with what string_classes actually was / is.
  • Loading branch information
wesleywu committed Jul 25, 2023
1 parent f907c70 commit 968458c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions taming/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import numpy as np
import torch
from taming.data.helper_types import Annotation
from torch._six import string_classes
from torch.utils.data._utils.collate import np_str_obj_array_pattern, default_collate_err_msg_format
from tqdm import tqdm

Expand Down Expand Up @@ -149,7 +148,7 @@ def custom_collate(batch):
return torch.tensor(batch, dtype=torch.float64)
elif isinstance(elem, int):
return torch.tensor(batch)
elif isinstance(elem, string_classes):
elif isinstance(elem, (str, bytes)):
return batch
elif isinstance(elem, collections.abc.Mapping):
return {key: custom_collate([d[key] for d in batch]) for key in elem}
Expand Down

0 comments on commit 968458c

Please sign in to comment.