maxjcohen / transformer

Implementation of Transformer model (originally from Attention is All You Need) applied to Time Series.
https://timeseriestransformer.readthedocs.io/en/latest/
GNU General Public License v3.0
842 stars 165 forks source link

NameError: chunk_mode "True" not understood. Must be one of chunk, window or None. #24

Closed kryptonite0 closed 3 years ago

kryptonite0 commented 3 years ago

Hello again, I just noticed you might want to change the default value of chunk_mode (currently it is set to boolean True).

from tst import transformer
from tst.transformer import Transformer
model = Transformer(d_input=1, d_model=4, d_output=1, q=8, v=8, h=8, N=2)
Traceback (most recent call last):
  File "/home/giulia/projects/transformer/venv/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3343, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-8d6b13c1d865>", line 1, in <module>
    model = Transformer(d_input=1, d_model=4, d_output=1, q=8, v=8, h=8, N=2)
  File "/home/giulia/projects/transformer/tst/transformer.py", line 76, in __init__
    chunk_mode=chunk_mode) for _ in range(N)])
  File "/home/giulia/projects/transformer/tst/transformer.py", line 76, in <listcomp>
    chunk_mode=chunk_mode) for _ in range(N)])
  File "/home/giulia/projects/transformer/tst/encoder.py", line 59, in __init__
    f'chunk_mode "{chunk_mode}" not understood. Must be one of {", ".join(chunk_mode_modules.keys())} or None.')
NameError: chunk_mode "True" not understood. Must be one of chunk, window or None.
kryptonite0 commented 3 years ago

I am about to send you a pull request with a fix (more might follow :) )

maxjcohen commented 3 years ago

Yes, I seem to have spent more time writing the doc than the actual code itself. Thanks again for your contribution !

kryptonite0 commented 3 years ago

Well that's a pretty good doc, made super easy to spot the problem ;) No worries mate, happy to give something back ^.^