How can I install torchtext?

I have PyTorch installed in my machine but whenever I try to do the following- from torchtext import data from torchtext import datasets I get the following error. ImportError: No module named...

Dataframe as datasource in torchtext

I have a dataframe, which has two columns (review and sentiment). I am using pytorch and torchtext library for preprocessing data. Is it possible to use dataframe as source to read data from, in...

how to save torchtext Dataset?

I'm working with text and use torchtext.data.Dataset. Creating the dataset takes a considerable amount of time. For just running the program this is still acceptable. But I would like to debug the...

pytorch: dyld: Symbol not found

I've installed pytorch and fastai via conda: conda list ... fastai 1.0.28 py_1 fastai pytorch 1.0.0 py3.6_1 ...

batch_size not match in torchtext BucketIterator

I have set batch_size equals to 64, but when i print out the train_batch and val_batch, the size is not equal to 64. The train data and val data are in the below format: First, i define TEXT and...

How to read in .txt file (corpus) into torchtext in pytorch?

How to read in .txt file (corpus) into torchtext in pytorrch? I only see data.Dataset for example datasets and data.TabularData for csv, json, and...

pytorch TypeError: '<' not supported between instances of 'Example' and 'Example' when referring to iterator

I am trying to use my own dataset to classify text according to https://github.com/bentrevett/pytorch-sentiment-analysis/blob/master/5%20-%20Multi-class%20Sentiment%20Analysis.ipynb. My dataset is...

OverflowError: Python int too large to convert to C long torchtext.datasets.text_classification.DATASETS['AG_NEWS']()

I have 64 bit windows 10 OS I have installed python 3.6.8 I have installed torch and torchtext using pip. torch version is 1.2.0 I am trying to load AG_NEWS dataset using below code: import...

Understanding TypeError: '<' not supported between instances of 'Example' and 'Example'

I am working on a project of text simplification using a multi-head attention transformer model. For the same, I am using torchtext for tokenisation and numericalization. The dataset contains two...

How to get rid of every column that are filled with zero from a Pytorch tensor?

I have a pytorch tensor A like below: A = tensor([[ 4, 3, 3, ..., 0, 0, 0], [ 13, 4, 13, ..., 0, 0, 0], [707, 707, 4, ..., 0, 0, 0], ..., ...

Language translation using TorchText (PyTorch)

I have recently started with ML/DL using PyTorch. The following pytorch example explains how we can train a simple model for translating from German to...

Saving vocabulary object from pytorch's torchtext library

Building a text classification model using pytorch's torchtext . The vocabulary object is in the data.field : def create_tabularDataset_object(self,csv_path): self.TEXT =...

CondaEnvException: Pip failed. I am getting a pip subprocess error when trying to create an environment in conda using a .yml file

I am trying to create an environment in conda using a .yml file. Here are the commands i have run, git clone https://github.com/fastai/fastai cd fastai conda env create -f environment.yml The...

OSError: [E050] Can't find model 'de'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory

So I am trying to make a seq to seq model for translating german to english using pytorch on online notebook like kaggle notebook and google colab import torch import torch.nn as nn import...

Unable to create custom dataset and dataloader using torchtext

I have questions regarding building custom dataset and iterator using torchtext. I used the following code found in this post and modified based on my case: tokenizer =...

Torchtext 0.7 shows Field is being deprecated. What is the alternative?

Looks like the previous paradigm of declaring Fields, Examples and using BucketIterator is deprecated and will move to legacy in 0.8. However, I don't seem to be able to find an example of the new...

How can I load a dataset into a pytorch torchtext.data.TabularDataset from a json having list of dicts?

I have a list of dicts as follows: [{'text': ['The', 'Fulton', 'County', 'Grand', ...], 'tags': ['AT', 'NP-TL', 'NN-TL', 'JJ-TL', ...]}, {'text': ['The', 'jury', 'further', 'said', ...], 'tags':...

Loading pre-trained BERT model error - Error no file named ['pytorch_model.bin', 'tf_model.h5'] found

I think my problem here is due to transformer version mismatch... but I would like some help with this... Previously I used the huggingface library to perform language model fine tuning. This...

How do I load the CelebA dataset on Google Colab, using torch vision, without running out of memory?

I am following a tutorial on DCGAN. Whenever I try to load the CelebA dataset, torchvision uses up all my run-time's memory(12GB) and the runtime crashes. Am looking for ways on how I can load and...

torchtext ImportError in colab

I am trying to run this tutorial in colab. However, when I try to import a bunch of modules: import io import torch from torchtext.utils import download_from_url from torchtext.data.utils import...

No module named 'torchtext._torchtext'

i have error work with torctext: ModuleNotFoundError Traceback (most recent call last) <ipython-input-65-e34e6e6439d5> in <module> 1 import torch 2 from...

AttributeError: module 'torchtext.data' has no attribute 'Field'

I want to run a git project used pytorch and torchtext but when I run it, it raise error: File "main.py", line 60, in <module> main() File "main.py", line 50, in main train_iters,...

Unable to import pytorch_lightning on google colab

I have done the following: !pip install pytorch_lightning -qqq import pytorch_lightning But get the following error: ImportError Traceback (most recent call...

Getting ImportError when using torchtext

I'm getting the following error when I try to run this line of code: from torchtext.data import Field, TabularDataset, BucketIterator, Iterator ImportError: cannot import name 'Field' from...

"module 'torchtext.data' has no attribute 'Field'"

import torchtext ENGLISH = torchtext.data.Field(tokenize=tokenizer_english, lower=True, init_token="<sos>",...

Stuck at this error "RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu"

I am running the following code. If I try to run it on CPU only it runs fine but it takes too much time to train. So I thought to change the runtime to GPU and made appropriate changes. Now it is...

Sudden Tensorflow / Keras Google Colab dependency problems `AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'`

I have running a machine learning model (Matterport's Mask R-CNN) in google colab for a couple of weeks. All of a sudden today I am unable to run any of my notebooks due to I think some kind of...

AttributeError: module 'torchtext.datasets' has no attribute 'text_classification'

agnews_train, agnews_test = torchtext.datasets.text_classification.DATASETS["AG_NEWS"](root="./datasets") after running above line I am geting attribute error. AttributeError ...

Cannot pip install mediapipe on Macos M1

Hello fellows I'm using mac air with M1 chip My env sets like (CV) san  ~/work/python  conda list # packages in environment at /Users/san/miniforge3/envs/CV: # # Name ...

How does one install pytorch 1.9 in an HPC that seems to refuse to cooperate?

I've been trying to install PyTorch 1.9 with Cuda (ideally 11) on my HPC but I cannot. The cluster says: Package typing-extensions conflicts for: typing-extensions torchvision -> pytorch==1.8.1 ->...