Google Colab-AttributeError: module 'torch' has no attribute 'float32'

(Mallikarjun Bendigeri) #1

In google colab,I installed fastai==0.7.0 and I see the below error when I import the fastai libraries

!pip install fastai==0.7.0

from fastai.imports import *
from fastai.models import *
from fastai.sgdr import *
from fastai.plots import *
from fastai.conv_learner import *
from fastai.transforms import *
from fastai.torch_imports import *
from fastai.dataset import *


AttributeError: module ‘torch’ has no attribute ‘float32’


Me, too.

Fastai v0.7 install issues thread

torchtext is the offending …?module?..(not sure what to call it) that causes this error. The authors released torchtext 0.3.1 earlier today (2018-10-11). Installing the previous version restores full functionality:
!{sys.executable} -m pip install torchtext==0.2.3

ImportError: cannot import name 'as_tensor'?
Error while importing modules

Bingo! I spend hours trying to get this work. Thank you so much @eunosM3.


no problem. glad it helped

(Jeremy Howard) #6

I’ve added that to the environment now btw.


@jeremy Terrific. Thanks for your attention to this matter.