Hey im having a problem creating an encoder from Chapter 15, Arch Details of the book

AttributeError Traceback (most recent call last)
Cell In[27], line 1
----> 1 encoder = create_body(resnet34,cut=-2)

File /opt/conda/lib/python3.10/site-packages/fastai/vision/learner.py:82, in create_body(model, n_in, pretrained, cut)
80 ll = list(enumerate(model.children()))
81 cut = next(i for i,o in reversed(ll) if has_pool_type(o))
—> 82 return cut_model(model, cut)

File /opt/conda/lib/python3.10/site-packages/fastai/vision/learner.py:71, in cut_model(model, cut)
69 def cut_model(model, cut):
70 “Cut an instantiated model”
—> 71 if isinstance(cut, int): return nn.Sequential(*list(model.children())[:cut])
72 elif callable(cut): return cut(model)
73 raise NameError(“cut must be either integer or a function”)

AttributeError: ‘function’ object has no attribute ‘children’

Hi Michael
What page in chapter 15?
Regards Conwyn

hey Conwyn it on the online book on the website