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

sequence length independent generation #45

Open
tmphex opened this issue May 25, 2021 · 7 comments
Open

sequence length independent generation #45

tmphex opened this issue May 25, 2021 · 7 comments

Comments

@tmphex
Copy link
Contributor

tmphex commented May 25, 2021

Currently generation require passing sequence length to generate sequences of given length but say in tasks such as summary or translation, one doesn't know about the final sequence length. Currently I am trying to generate candidates with passing various lengths as work around. Also is it possible to add support for beam search method for generation in addition to current top_p/top_k methods.

@lucidrains
Copy link
Owner

@tmphex i believe there's already support for detecting end of string tokens https://github.com/lucidrains/x-transformers/blob/main/x_transformers/autoregressive_wrapper.py#L45

@lucidrains
Copy link
Owner

as for beam search, let me think about it - i saw some paper out there with some fast optimized beam search, and maybe its worth creating a separate repo for that

@tmphex
Copy link
Contributor Author

tmphex commented May 26, 2021

Thanks @lucidrains for pointing out the eos_token I have created a PR to be able to pass arguments directly to model.generate function rather than need to call model.decoder.generate.

I look forward to try out the optimized beam search once available.

@lucidrains
Copy link
Owner

@tmphex ohh yes, you indeed found a bug, thank you! one other thing is that the eos_token may not work when the batch size is greater than 1, but i'll get that fixed this week (we can keep this issue open)

@tmphex
Copy link
Contributor Author

tmphex commented Jun 2, 2021

@lucidrains just pinging if you gotten around fixing the eos_token and adding beam search support 🙏

@tmphex
Copy link
Contributor Author

tmphex commented Jun 10, 2021

Newly released Fastseq (https://github.com/microsoft/fastseq) might be interesting to integrate with when you plan to work on optimizing generation and beam search support

@tmphex
Copy link
Contributor Author

tmphex commented Aug 12, 2021

@lucidrains seems like eos_token issue has been fixed. If you plan to implement the beam-search then we can keep this issue open otherwise feel free to close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants