0

When I am running datasets_utils.py from '/usr/local/lib/python3.7/dist-packages/torchtext/data/datasets_utils.py' in Google Colab, the following error occurs even with the most updated versions of Python packages:

ImportError: cannot import name 'functional_datapipe' from 'torch.utils.data' (/usr/local/lib/python3.7/dist-packages/torch/utils/data/init.py)

Are there any solutions to solve such errors, as I could not find functional_datapipe even in the official torch.utils.data documentation? The following is excerpt from datasets._utils.py in the Google Colab environment

import functools
import inspect
import os
import io
import torch
from torchtext.utils import (
    validate_file,
    download_from_url,
    extract_archive,
)
from torch.utils.data import functional_datapipe, IterDataPipe
from torch.utils.data.datapipes.utils.common import StreamWrapper
import codecs

1 Answer 1

2

It might be available only on torchdata.datapipes

Sign up to request clarification or add additional context in comments.

3 Comments

But there is still no such function in that library. It is still confusing because even local Python 3.8 site-packages/torch/utils/data/__init__.py contain functional_datapipe and IterDataPipe.\
There is also one more issue: the line "from torch.utils.data.datapipes.utils.common import StreamWrapper" keeps getting issues besides the above lines. How such errors can occur considering they have been imported from site packages?
How is it related to the functional_datapipe from torchtext? I presume they are different though

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.