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

Allowing non-fixed length generation #87

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sirmammingtonham
Copy link

@sirmammingtonham sirmammingtonham commented Jul 13, 2019

A quick hack for generating longer than 1024 tokens (feeds a fraction of output as context until a truncation token is reached). Not the most efficient method but it gets the job done.

Non-fixed length generation works when length is None or 0, and the fraction of output used for context is specified by split_context

Hopefully this closes #2

@minimaxir
Copy link
Owner

oo

Will need to test this but it sounds neat!

@sirmammingtonham
Copy link
Author

Thanks! I did some more testing and realized that there were a lot issues with my first commit, namely that the generation would use the same context for all samples in a batch and that generation would stop completely when one sample reached truncation for batch_size larger than 1. There was also an issue with it repeating the context twice in the output.

I just updated it with a new commit which should have fixed all the issues above and also allows for generation larger than 1024 tokens without a truncation term (it will stop generation when the output has reached that length).

This version hopefully runs faster as well (i realized that i could just take a slice of the out array as context instead of having to decode and re-encode it lol).

@minimaxir minimaxir mentioned this pull request Sep 26, 2019
@saippuakauppias
Copy link

Any updates or ideas?

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

Successfully merging this pull request may close these issues.

Allow users to generate texts longer than 1024 tokens
3 participants