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

Improve log messages around the max sequence length #103

Merged
merged 4 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions router/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ impl<'a, B: BatchType> BatchConfigValidator<'a, B> {
self.batch_type.prefill_weight(&single_request_stats, 1);
if max_batch_weight < single_request_prefill_weight {
panic!(
"max_batch_weight ({}) not large enough for (prefill) max_sequence_length ({})",
max_batch_weight, max_sequence_length
"The provided max_sequence length ({}) results in a prefill batch weight that exceeds the estimated capacity ({})",
max_sequence_length, max_batch_weight
)
}

Expand All @@ -232,8 +232,8 @@ impl<'a, B: BatchType> BatchConfigValidator<'a, B> {
.batch_initial_weight(&single_request_stats, 1);
if max_batch_weight < single_request_nexttoken_weight {
panic!(
"max_batch_weight ({}) not large enough for (next-token) max_sequence_length ({})",
max_batch_weight, max_sequence_length
"The provided max_sequence length ({}) results in a next-token batch weight that exceeds the estimated capacity ({})",
max_sequence_length, max_batch_weight
)
}
}
Expand Down
10 changes: 6 additions & 4 deletions server/text_generation_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,15 @@ def estimate_memory():
memory_scaling_model = estimate_memory()
compile()

max_input = memory_scaling_model.max_input_len_for_nt(1, max_sequence_length-1, sys.maxsize)
max_output = memory_scaling_model.max_output_len_for_nt(1, max_sequence_length-1, sys.maxsize)

if local_rank == 0:
# For a batch of size 1 and an output of 1, get max input limited by max_sequence_length
max_input = memory_scaling_model.max_input_len_for_nt(1, 1, max_sequence_length)
# For a batch of size 1 and an input of 1, get max output limited by max_sequence_length
max_output = memory_scaling_model.max_output_len_for_nt(1, 1, max_sequence_length)
max_theoretical_len = min(max_input, max_output) + 1
print(
"Maximum possible sequence length given available memory (for batch size 1): "
f"{min(max_input, max_output)}"
f"{max_theoretical_len}"
)

elif ESTIMATE_MEMORY == "manual":
Expand Down