Skip to content

Fix max allowed lengths for prompts larger than 4096 #74

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 6 commits into
base: main
Choose a base branch
from

Conversation

ani300
Copy link
Contributor

@ani300 ani300 commented Jul 3, 2025

This takes cares of an oversight that prevented prompts longer than 4k from being run with generate()

ani300 added 2 commits July 3, 2025 20:55
Signed-off-by: Antoni Viros i Martin <aviros@ibm.com>
Signed-off-by: Antoni Viros i Martin <aviros@ibm.com>
@ani300 ani300 requested a review from JRosenkranz July 3, 2025 21:02
@@ -27,6 +27,7 @@ def adjust_inputs_to_batch(input_ids: torch.Tensor, **extra_kwargs):
def generate(
model: Union[Callable, torch.nn.Module],
input_ids: torch.Tensor,
max_seq_len: int = 4096,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we anticipate this getting used? or is it just a placeholder to grab the max_seq_len param if passed to fms generate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to match the signature between both generate() calls and avoid errors yes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may just want this to be part of the attention_specific_kwargs in the inference and warmup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -53,6 +53,7 @@ def warmup_model(
generate(
model,
_warmup_input_ids,
max_seq_len=_warmup_input_ids.shape[1] + max_new_tokens,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we just add this to the attention_specific_kwargs in line 32? this way we don't need to change the signature of paged generate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ani300 added 3 commits July 11, 2025 22:15
Signed-off-by: Antoni Viros i Martin <aviros@ibm.com>
Signed-off-by: Antoni Viros i Martin <aviros@ibm.com>
Signed-off-by: Antoni Viros i Martin <aviros@ibm.com>
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.

2 participants