Welcome to the Linux Foundation Forum!

(Self-solved) Chap8,Lab4 "Dataset": Encountered "ImportError" about "DILL_AVAILABLE"

m.taniguchi
m.taniguchi Posts: 24
edited May 1 in LFD273 Class Forum

I encountered an error on Lab4 "Dataset" part in Chap8.
This is a workaround I did.

[Problem I encountered]

When executed 4th cell,

from torchtext.datasets import SST2
datapipes = {}
# write your code here
datapipes['train'] = SST2(split='train')
datapipes['val'] = SST2(split='dev')

then following error came up.

ImportError: cannot import name ‘DILL_AVAILABLE’ from ‘torch.utils.data.datapipes.utils.common’

[Workaround I did]

Following link seems to be about same problem.

https://discuss.dgl.ai/t/importerror-cannot-import-name-dill-available-from-torch-utils-data-datapipes-utils-common/4363

And this refers to a following PR to PyTorch upstream.

https://github.com/pytorch/pytorch/pull/122616

This PR provides two modifications torch/utils/data/datapipes/utils/common.py , so I modified the file following the modifications and re-executed. Then, worked fine (i.e. no error came up).

Thanks,

Comments

  • m.taniguchi
    m.taniguchi Posts: 24
    edited May 1

    [My Environment]
    OS : Ubuntu20.04LTS
    Python : 3.8.10
    torch : 2.3.0
    torchdata : 0.7.1
    torchtext : 0.18.0
    torchvision : 0.18.0

  • dvgodoy
    dvgodoy Posts: 6

    Hi @m.taniguchi

    Thank you for already providing the solution/workaround for this PyTorch 2.3 issue!

Categories

Upcoming Training