[FlexAttention] Avoid encoder block-mask compile explosion (#50339)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Andreas Karatzas
2026-07-30 11:24:13 -04:00
committed by GitHub
parent 30b4e7f479
commit 5b95890742
4 changed files with 66 additions and 13 deletions
@@ -20,7 +20,9 @@ from vllm.platforms import current_platform
def _generate_random_text(word_count: int) -> str:
"""Generate random text with approximately the specified word count."""
"""Generate deterministic text with approximately the specified word count."""
rng = random.Random(word_count)
# Common English words with focus on verbs and nouns for realistic text
common_words = [
# Essential articles and pronouns (minimal)
@@ -178,7 +180,7 @@ def _generate_random_text(word_count: int) -> str:
words = []
for _ in range(word_count):
words.append(random.choice(common_words))
words.append(rng.choice(common_words))
# Add some punctuation for more realistic text
text = " ".join(words)
@@ -187,7 +189,7 @@ def _generate_random_text(word_count: int) -> str:
result = []
for i, word in enumerate(words_list):
result.append(word)
if (i + 1) % random.randint(10, 20) == 0 and i < len(words_list) - 1:
if (i + 1) % rng.randint(10, 20) == 0 and i < len(words_list) - 1:
result[-1] += "."
return " ".join(result)