Skip to content

AttributeError: 'function' object has no attribute 'named_parameters' #11

@chsaiujwal

Description

@chsaiujwal

I tried to pip install fastai==2.4 but couldn't as colab couldn't find 2.4 version of fastai. so i just installed pip install fastai. whenever i try to run the trained model, i get the error

AttributeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 net_G = build_res_unet(n_input=1, n_output=2, size=256)
2 net_G.load_state_dict(torch.load("res18-unet.pt", map_location=device))
3 model = MainModel(net_G=net_G)
4 train_model(model, train_dl, 20)

3 frames
/usr/local/lib/python3.10/dist-packages/fastai/vision/learner.py in _get_first_layer(m)
32 "Access first layer of a model"
33 c,p,n = m,None,None # child, parent, name
---> 34 for n in next(m.named_parameters())[0].split('.')[:-1]:
35 p,c=c,getattr(c,n)
36 return c,p,n

AttributeError: 'function' object has no attribute 'named_parameters'

please let me know how to fix it. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions