Skip to content

Fix: can_append function returns incorrect result #65

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

YjyJeff
Copy link

@YjyJeff YjyJeff commented Jul 2, 2025

The can_append function in the BlockManager returns a boolean that indicates whether we can store a sampled token for the given sequence. Currently, the code snippet len(seq) % self.block_size == 1 is wrong. Considering a block_size of 16, we currently have 17 tokens. According to the current code logic, it would return 1, indicating that we need at least one additional block for storage. However, in reality, we do not need an extra block—an additional block is required only when the length is an exact multiple of the block size.

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