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

Error when generating with long prefix #38

Open
anishthite opened this issue May 9, 2019 · 4 comments
Open

Error when generating with long prefix #38

anishthite opened this issue May 9, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@anishthite
Copy link

anishthite commented May 9, 2019

Hi! When I generate text with a prefix longer than 4 characters, I get the following error:
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0,0] = 1024 is not in [0, 1024)[[{{node sample_sequence_6/while/model/GatherV2_1}}]]

It does not occur if the prefix is "Hi!", but it does occur when it is "Hi, this is a longer piece of text"
Do you know why this may be happening?

@anishthite anishthite changed the title Error when generating wiht long prefix Error when generating with long prefix May 9, 2019
@anishthite
Copy link
Author

The issue does not occur when using the original generate script from OpenAI

@anishthite
Copy link
Author

It seems to be occurring on this line:
out = sess.run(output, feed_dict={ context: batch_size * [context_tokens] })
the OpenAI script has
for _ in range(nsamples // batch_size): out = sess.run(output, feed_dict={ context: [context_tokens for _ in range(batch_size)] })[:, len(context_tokens):]

Could this difference be causing the issue?

@minimaxir
Copy link
Owner

Looking into this now since it is affecting the cloud API. It's possible this difference could affect it.

@minimaxir minimaxir added the bug Something isn't working label Jun 16, 2019
@minimaxir
Copy link
Owner

Able to reproduce, but only if the generated length is long as well (which is the default, and explains why I haven't seen the issue as I work with smaller texts)

It's possible the prefix length in tokens + generated text in tokens > 1024. It might be a good idea to cap the length at that difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants