Reputation: 41
I'm trying to use fastai to figure out an optimal learning rate for my neural network. Everything else is working fine I'm just not quite getting the accuracy I want. So I'm trying to use the following lines of code to optimize my learning rate:
learn.lr_find()
learn.sched.plot_lr()
So I pip installed fastai and everything seemed like it installed correctly and into the correct directory, but every time I try to import fastai, I can't. I included pictures of my command prompt and the error message. Thank you all for the help in advance I really appreciate it. If I didn't provide enough info just let me know. I'm new to asking questions on here. Error Message
Upvotes: 4
Views: 3475
Reputation: 453
From the screenshots provided, it seems like you didn't install FastAi properly and you were installing PyTorch instead. FastAi comes with a PyTorch build. So you don't need to install PyTorch separately.
You can install FastAi with Pip by the following command
pip install fastai
If you are using Python 3.x sometimes you might need to use pip3 command instead
pip3 install fastai
Another problem might be Python mismatch. Maybe you've installed the both version of Python and you distro couldn't verify from where to grab the package. So make sure to use the correct Python and Pip version
Upvotes: 3
Reputation: 324
I would recommend waiting for the new release of fastai
, they are currently working on version 2 in July.
Learner.lr_find(start_lr=1e-07, end_lr=10, num_it=100, stop_div=True, show_plot=True, suggestions=True)
Upvotes: 0
Reputation: 1516
I had a similar issue where I installed fastai with pip. I got the 'No module named fastai' error whenever I tried to import fastai, but if I did "pip freeze | grep fastai" in the terminal, it showed that fastai was clearly installed.
The solution for me was to download anaconda3, enter an anaconda environment, and reinstall fastai with conda using step 6 of fastai's setup instructions for using AWS EC2 instances.
Useful links:
https://docs.anaconda.com/anaconda/install/linux/
https://course.fast.ai/start_aws.html
Upvotes: 1