2

When I use the fast.ai, T encounter this problem,the follow is my code:

from fastai.vision.all import *
from fastai.text.all import *
from fastai.collab import *
from fastai.tabular.all import *

device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')

path = untar_data(URLs.PETS)/'images'

def is_cat(x): return x[0].isupper()

dls = ImageDataLoaders.from_name_func(
    path, get_image_files(path), valid_pct=0.2, seed=42,
    label_func=is_cat, item_tfms=Resize(224))

learn = cnn_learner(dls, resnet34, metrics=error_rate).to(device)

learn.fine_tune(1)

It shows :"ModuleAttributeError: 'Sequential' object has no attribute 'fine_tune'"

ZachSun
  • 21
  • 1
  • Similar problem with learn.fit_one_cycle but the error is "no attribute 'fit_one_cyle'" – user2180171 May 10 '21 at 13:01
  • Does this answer your question? [fast.ai not using the GPU](https://stackoverflow.com/questions/70351366/fast-ai-not-using-the-gpu) – Julia Aug 17 '22 at 12:54

1 Answers1

0

fastai will select GPU for you if available.

I reproduced your problem and getting rid of the .to(device) call in the Learner got the error away:

learn = cnn_learner(dls, resnet34, metrics=error_rate)
learn.fine_tune(1)
Alberto Caso
  • 93
  • 1
  • 4