Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XResNet object has no attribute 'backbone' #332

Closed
GitInTheRobot opened this issue Dec 21, 2021 · 2 comments
Closed

XResNet object has no attribute 'backbone' #332

GitInTheRobot opened this issue Dec 21, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@GitInTheRobot
Copy link

There's a problem with the way ts_learner constructs a learn instance when used with xresnet. It gives the following error:

AttributeError:

'XResNet' object has no attribute 'backbone'
  File "/root/tsai/tsai/tsai/models/utils.py", line 82, in ts_splitter
    return L(m.backbone, m.head).map(params)
  File "/root/test_py.py", line 16, in <module>
    learn.fit_one_cycle(10, 1e-3)

Code

from tsai.all import *

dsid = 'NATOPS' 
X_train, y_train, X_test, y_test  = get_UCR_data(dsid, return_split=True)
X, y, splits = combine_split_data([X_train, X_test], [y_train, y_test])
print(X.shape)
print(y.shape)
tfms  = [None, [Categorize()]]
dsets = TSDatasets(X, y, tfms=tfms, splits=splits, inplace=True)
dls = TSDataLoaders.from_dsets(dsets.train, dsets.valid, bs=[64, 128], batch_tfms=[TSStandardize()], num_workers=0)

# this works
#model = create_model(xresnet1d18, dls=dls)
#learn = Learner(dls, model)

# this doesn't work
learn = ts_learner(dls, xresnet1d18)
learn.fit_one_cycle(10, 1e-3)

I am using tsai 0.2.25.

@oguiza oguiza added the bug Something isn't working label Dec 21, 2021
oguiza pushed a commit that referenced this issue Dec 21, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@oguiza
Copy link
Contributor

oguiza commented Dec 21, 2021

Hi @GitInTheRobot, thanks for reporting this issue. I've analyzed it and it was indeed a bug. I've now fixed it in GitHub.
It'd be great if you could retest it and confirm it works well using:

!pip install git+https://github.com/timeseriesAI/tsai.git  >> /dev/null

@oguiza
Copy link
Contributor

oguiza commented Jan 11, 2022

I'll close this issue due to a lack of response. Please, reopen if necessary.

@oguiza oguiza closed this as completed Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants