fastai / fastai

The fastai deep learning library
http://docs.fast.ai
Apache License 2.0
26.18k stars 7.55k forks source link

from fastai.conv_learner import * #1344

Closed MinuteswithMetrics closed 5 years ago

MinuteswithMetrics commented 5 years ago

Describe the bug

Was conv_learner replaced in v1? from fastai.conv_learner import * produces the following error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-c214d6004a52> in <module>()
----> 1 from fastai.conv_learner import *
      2 from fastai.dataset import *
      3 
      4 import pandas as pd
      5 import numpy as np

ModuleNotFoundError: No module named 'fastai.conv_learner' 

To Reproduce

from fastai.conv_learner import *

Expected behavior

Myself and other Kagglers are experiencing ModuleNotFoundError when Kaggle updated fastai to v1. I was wondering if conv_learner was replaced in the new version. If so, what cmd replaces the line of code mentioned above. I was able to figure out that from fastai.dataset import * is now from fastai.datasets import * Any assistance would be helpful. Thank you for an awesome library!

`--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last)

in () ----> 1 from fastai.conv_learner import * 2 from fastai.dataset import * 3 4 import pandas as pd 5 import numpy as np ModuleNotFoundError: No module named 'fastai.conv_learner'` **Screenshots** **Additional context** I included the Kaggle Kernel that shows a kernel using fast.ai 0.7 and does not work since Kaggle updated to v1. [https://www.kaggle.com/hung96ad/resnet34-with-rgby-fast-ai-fork-127e02](url)
stas00 commented 5 years ago

fastai v1 is very incompatible with v0.7. You will need to either rewrite your code to use the v1 API (https://docs.fast.ai/) or to carry both versions and load v0.7 for the old kernels and v1 for the new ones.

MinuteswithMetrics commented 5 years ago

Thank you. Is it possible to clone v0.7? Tried doing pip install, but that doesn't work.

stas00 commented 5 years ago

If you want it on the fly, this may do the trick (installing a subdir old, where v0.7 currently lives - in the same repo as v1.0):

pip install git+https://github.com/fastai/fastai.git#subdirectory=old

but otherwise you follow the normal instructions: https://forums.fast.ai/t/fastai-v0-7-install-issues-thread/24652

the problem is that currently it's not setup for having both versions in the same environment, so probably some path manipulation will be required. so if you switch to fastai-v1 as normal, then install fastai v0.7 into a hidden path, and prepend it onto sys.path before loading it in kernels that rely on fastai-0.7:

sys.path.insert(0, "/path/to/fastai/v.0.7")
import fastai
MinuteswithMetrics commented 5 years ago

Thank you stas00. It worked.

darshanraikanungo commented 5 years ago

fastai.conv_learner is available in old version of fastai. install old version using pip install fastai==0.7.0 --no-deps