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

Major bug & fix: Fix bug in batched multi sample generation #1025

Merged
merged 4 commits into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions outlines/generate/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def __call__(

# We reshape the output to (batch_size, sample_size)
output: List[List[FormattedOutput]] = list()
for i in range(batch_size):
for i in range(0, batch_size * num_samples, num_samples):
output.append(formatted[i : i + num_samples])

# We remove leading dimensions for the output
Expand Down Expand Up @@ -372,7 +372,7 @@ def token_generator() -> Iterator[Union[List[str], str, List[List[str]]]]:
previously_generated_sequences = generated_sequences
# We reshape the output to (batch_size, sample_size)
output: List[List[str]] = list()
for i in range(batch_size):
for i in range(0, batch_size * num_samples, num_samples):
output.append(next_tokens[i : i + num_samples])

# We remove leading dimensions for the output
Expand Down
Loading