timeseriesAI / tsai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai
https://timeseriesai.github.io/tsai/
Apache License 2.0
4.95k stars 625 forks source link

TypeError: __init__() got an unexpected keyword argument 'custom_head' #759

Closed hiromis closed 1 year ago

hiromis commented 1 year ago

This line results in "TypeError: init() got an unexpected keyword argument 'custom_head'":

learn = ts_learner(dls, InceptionTime, metrics=[mae, rmse], cbs=ShowGraph())

image

The cause seems to be InceptionTime's init takes **kwargs but InceptionModule does not. If you look at the signature the wildcard is in between InceptionTime's constructor arguments and InceptionModule's:

image

I would assume adding kwargs to InceptionModule's constructor, and possibly remove kwargs from InceptionBlock and InceptionTime's constructor will fix the issue but I am still not familiar with the code enough to say that definitely.

oguiza commented 1 year ago

Hi @hiromis, Can you try using InceptionTimePlus instead of InceptionTime? All models ending in Plus within tsai allow you to pass targets with different shapes. They use a custom head to recreate an output of the same shape as the target.

hiromis commented 1 year ago

Worked for me. Thanks!