lucidrains / h-transformer-1d

Implementation of H-Transformer-1D, Hierarchical Attention for Sequence Learning
MIT License
154 stars 21 forks source link

eos token does not work in batch mode generation #9

Closed tmphex closed 3 years ago

tmphex commented 3 years ago

When generating the sequence with current code it seems the eos_token will work when generating one sequence at a time https://github.com/lucidrains/h-transformer-1d/blob/main/h_transformer_1d/autoregressive_wrapper.py#L59

lucidrains commented 3 years ago

ohh, this is indeed a bug, and i'll fix this today

lucidrains commented 3 years ago

@tmphex let me know if this https://github.com/lucidrains/h-transformer-1d/commit/e3cb1afee7a1c8895180d89aa3a9c51ef42c8d3a works for you

tmphex commented 3 years ago

Thanks @lucidrains for fixing it quickly. I think its the same issue in x-transformers repo too. https://github.com/lucidrains/x-transformers/blob/main/x_transformers/autoregressive_wrapper.py#L80

lucidrains commented 3 years ago

Thanks @lucidrains for fixing it quickly. I think its the same issue in x-transformers repo too. https://github.com/lucidrains/x-transformers/blob/main/x_transformers/autoregressive_wrapper.py#L80

haha yup, i'll fix it there too