Skip to content

Remove unnecessary conditional cropping of sequence context in generate()#671

Open
michalczaplinski wants to merge 2 commits intokarpathy:masterfrom
michalczaplinski:patch-1
Open

Remove unnecessary conditional cropping of sequence context in generate()#671
michalczaplinski wants to merge 2 commits intokarpathy:masterfrom
michalczaplinski:patch-1

Conversation

@michalczaplinski
Copy link

In python, negative slicing is "clamped" to the available range. If the tensor's dimension is smaller than the slice size, it just returns all elements without any error. For this reason, we can always call idx[:, -self.config.block_size:] regardless of the value of idx.size(1).

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.

1 participant