[test] Added test_align.py and Before change nanovllm attention.

This commit is contained in:
Zijie Tian
2026-01-04 22:48:01 +08:00
parent 24096431ed
commit e897380127
3 changed files with 58 additions and 33 deletions

View File

@@ -480,7 +480,7 @@ class ModelRunner:
if input_ids.numel() == 0:
break
# Run model forward
#> Run model forward
logits = self.run_model(input_ids, positions, is_prefill=True)
reset_context()

View File

@@ -34,6 +34,14 @@ class Sequence:
def __getitem__(self, key):
return self.token_ids[key]
def __repr__(self):
ids = self.token_ids
if len(ids) > 20:
ids_str = "[" + ", ".join(map(str, ids[:10])) + ", ..., " + ", ".join(map(str, ids[-5:])) + "]"
else:
ids_str = str(ids)
return f"Seq(id={self.seq_id}, status={self.status.name}, tokens={self.num_tokens}, ids={ids_str})"
@property
def is_finished(self):
return self.status == SequenceStatus.FINISHED