How to define 'LooseVersion'


(Fakhrul Islam Masum) #1

Code:
from future import division,print_function
!pip3 install fastai
!apt update && apt install -y libsm6 libxext6
!pip install torchtext==0.2.3.
from distutils.version import LooseVersion

import os, json
from glob import glob
import numpy as np
np.set_printoptions(precision=4, linewidth=100)
from matplotlib import pyplot as plt

from fastai.imports import *
from fastai.transforms import *
from fastai.conv_learner import *
from fastai.model import *
from fastai.dataset import *
from fastai.sgdr import *
from fastai.plots import *

Error Log:

NameError Traceback (most recent call last)

<ipython-input-17-a9c9423cd45d> in <module>() 12 13 from fastai.imports import * —> 14 from fastai.transforms import * 15 from fastai.conv_learner import * 16 from fastai.model import *

/usr/local/lib/python3.6/dist-packages/fastai/transforms.py in <module>() 1 from .imports import * ----> 2 from .layer_optimizer import * 3 from enum import IntEnum 4 5 def scale_min(im, targ, interpolation=cv2.INTER_AREA):

/usr/local/lib/python3.6/dist-packages/fastai/layer_optimizer.py in <module>() 1 from .imports import * 2 from .torch_imports import * ----> 3 from .core import * 4 5 def opt_params(parm, lr, wd):

/usr/local/lib/python3.6/dist-packages/fastai/core.py in <module>() 61 return v.cpu().numpy() 62 —> 63 IS_TORCH_04 = LooseVersion(torch.version) >= LooseVersion(‘0.4’) 64 USE_GPU = torch.cuda.is_available() 65 def to_gpu(x, *args, **kwargs):

NameError: name ‘LooseVersion’ is not defined