vllm.sequence
Sequence and its related classes.
CompletionSequenceGroupOutput
¶
Bases: Struct
The model output associated with a completion sequence group.
Source code in vllm/sequence.py
__eq__
¶
ExecuteModelRequest
¶
Bases: Struct
The model execution request, containing CPU metadata only. The LLM engine should create an instance of this class for each request batch.
Source code in vllm/sequence.py
1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 |
|
blocks_to_copy
class-attribute
instance-attribute
¶
blocks_to_swap_in
class-attribute
instance-attribute
¶
blocks_to_swap_out
class-attribute
instance-attribute
¶
finished_requests_ids
class-attribute
instance-attribute
¶
last_sampled_token_ids
class-attribute
instance-attribute
¶
previous_hidden_states
class-attribute
instance-attribute
¶
previous_hidden_states: Optional[HiddenStates] = None
seq_group_metadata_list
instance-attribute
¶
seq_group_metadata_list: list[
Union[SequenceGroupMetadata, SequenceGroupMetadataDelta]
]
clone
¶
clone(
seq_group_metadata_list: list[
Union[
SequenceGroupMetadata,
SequenceGroupMetadataDelta,
]
],
) -> ExecuteModelRequest
Clone the request with a new sequence group metadata list.
Source code in vllm/sequence.py
HiddenStates
¶
Bases: Struct
Hidden states corresponding to in-progress sequences. Used in speculative decoding to pass hidden states from the target model to the proposer model.
seq_ids are the sequence ids of each entry of the batch dimension of the hidden_states tensor
Source code in vllm/sequence.py
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 |
|
second_last_token_hidden_states
class-attribute
instance-attribute
¶
seq_group_metadata_list
class-attribute
instance-attribute
¶
seq_group_metadata_list: Optional[
list[SequenceGroupMetadata]
] = None
__post_init__
¶
expand_with_bonus_tokens
¶
expand_with_bonus_tokens(
seq_with_bonus_token_in_last_step: set,
) -> None
Expand hidden states for sequences with bonus tokens. This is in
alignment with MultiStepWorker._expand_execute_model_request
.
Source code in vllm/sequence.py
prune
¶
prune(
seq_group_metadata_list: list[SequenceGroupMetadata],
) -> None
Prune to provided list of sequence ids. Only used for decode steps.
Source code in vllm/sequence.py
update
¶
update(
hidden_states: Tensor,
seq_group_metadata_list: list[SequenceGroupMetadata],
second_last_token_hidden_states: Optional[
Tensor
] = None,
)
Update hidden states from target model invocation. Only used for decode steps
Source code in vllm/sequence.py
IntermediateTensors
dataclass
¶
For all pipeline stages except the last, we need to return the hidden states and residuals to be sent to the next stage. This data structure contains the hidden states and residuals for a request.
Source code in vllm/sequence.py
Logprob
dataclass
¶
Infos for supporting OpenAI compatible logprobs and token ranks.
Attributes:
Name | Type | Description |
---|---|---|
logprob |
float
|
The logprob of chosen token |
rank |
Optional[int]
|
The vocab rank of chosen token (>=1) |
decoded_token |
Optional[str]
|
The decoded chosen token index |
Source code in vllm/sequence.py
ParallelSampleSequenceGroup
dataclass
¶
Bases: SequenceGroupBase
Source code in vllm/sequence.py
1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 |
|
add_request
staticmethod
¶
add_request(request_id: str, engine, params, **kwargs)
Source code in vllm/sequence.py
maybe_assemble_group
¶
maybe_assemble_group(
seq_group: SequenceGroup,
) -> Optional[SequenceGroup]
Source code in vllm/sequence.py
PoolerOutput
¶
Bases: Struct
The output from a pooling operation in the pooling model.
Source code in vllm/sequence.py
__getitem__
¶
__getitem__(idx: int) -> PoolingSequenceGroupOutput
__len__
¶
__setitem__
¶
__setitem__(idx: int, value: PoolingSequenceGroupOutput)
PoolingSequenceGroupOutput
¶
Bases: Struct
The model output associated with a pooling sequence group.
Source code in vllm/sequence.py
__eq__
¶
RequestMetrics
dataclass
¶
Metrics associated with a request.
Attributes:
Name | Type | Description |
---|---|---|
arrival_time |
float
|
The time when the request arrived. |
first_scheduled_time |
Optional[float]
|
The time when the request was first scheduled. |
first_token_time |
Optional[float]
|
The time when the first token was generated. |
time_in_queue |
Optional[float]
|
The time the request spent in the queue. |
finished_time |
Optional[float]
|
The time when the request was finished. |
scheduler_time |
Optional[float]
|
The time spent in the scheduler when this request was being considered by the scheduler. |
model_forward_time |
Optional[float]
|
The time spent in the model forward pass when this request was in the batch. |
model_execute_time |
Optional[float]
|
The time spent in the model execute function. This will include model forward, block/sync across workers, cpu-gpu sync time and sampling time. |
spec_token_acceptance_counts |
Optional[list[int]]
|
number of accepted speculative tokens at each position; the first token is from the target model and is always accepted; e.g., when it's [10, 8, 4, 2] for a req, it means there were 10 forward passes in total, and there were 8, 4, 2 accepted tokens at 1st, 2nd, 3rd speculation step. |
Source code in vllm/sequence.py
spec_token_acceptance_counts
class-attribute
instance-attribute
¶
__init__
¶
__init__(
arrival_time: float,
last_token_time: float,
first_scheduled_time: Optional[float],
first_token_time: Optional[float],
time_in_queue: Optional[float],
finished_time: Optional[float] = None,
scheduler_time: Optional[float] = None,
model_forward_time: Optional[float] = None,
model_execute_time: Optional[float] = None,
spec_token_acceptance_counts: Optional[
list[int]
] = None,
) -> None
Sequence
¶
Stores the data, status, and block information of a sequence.
The sequence is constructed from the
DecoderOnlyInputs
(for decoder-only)
or EncoderDecoderInputs
(for encoder-decoder) instance passed in through the inputs
constructor argument.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seq_id
|
int
|
The ID of the sequence. |
required |
inputs
|
SingletonInputs
|
The inputs of the sequence. |
required |
block_size
|
int
|
The block size of the sequence. Should be the same as the block size used by the block manager and cache engine. |
required |
eos_token_id
|
Optional[int]
|
The end-of-sequence (EOS) token id recognized by this LLM. |
None
|
lora_request
|
Optional[LoRARequest]
|
LoRA request. |
None
|
prompt_adapter_request
|
Optional[PromptAdapterRequest]
|
Prompt Adapter request. |
None
|
Source code in vllm/sequence.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 |
|
data
instance-attribute
¶
data = from_seqs(
prompt_token_ids,
prompt_embeds=inputs["prompt_embeds"]
if inputs["type"] == "embeds"
else None,
)
__init__
¶
__init__(
seq_id: int,
inputs: SingletonInputs,
block_size: int,
eos_token_id: Optional[int] = None,
lora_request: Optional[LoRARequest] = None,
prompt_adapter_request: Optional[
PromptAdapterRequest
] = None,
) -> None
Source code in vllm/sequence.py
append_token_id
¶
append_token_id(
token_id: int,
logprobs: dict[int, Logprob],
token_embed: Optional[Tensor] = None,
) -> None
Source code in vllm/sequence.py
extra_hash
¶
This function computes an extra hash for a sequence, specifically designed for prefix caching mode. The final sequence hash is determined by applying token_ids from the sequence's blocks.
Source code in vllm/sequence.py
fork
¶
get_num_new_tokens
¶
get_num_new_tokens() -> int
get_output_text_to_return
¶
If delta is True, only new text since the last call to this method is returned
Source code in vllm/sequence.py
get_output_token_ids
¶
get_output_token_ids_to_return
¶
If delta is True, only new tokens since the last call to this method are returned
Source code in vllm/sequence.py
get_prompt_token_ids
¶
get_token_ids
¶
hash_of_block
¶
Source code in vllm/sequence.py
SequenceData
¶
Bases: Struct
Data associated with a sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt_token_ids
|
The token IDs of the prompt. |
required | |
output_token_ids
|
The token IDs of the output. Set to an empty list if None. |
required |
Attributes:
Name | Type | Description |
---|---|---|
prompt_token_ids |
tuple[int, ...]
|
The token IDs of the prompt. |
output_token_ids |
tuple[int, ...]
|
The token IDs of the output. |
cumulative_logprob |
float
|
The cumulative log probability of the output. |
Source code in vllm/sequence.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
|
_cached_all_token_embeds
class-attribute
instance-attribute
¶
_cached_all_token_ids
class-attribute
instance-attribute
¶
_mrope_position_delta
class-attribute
instance-attribute
¶
_new_appended_tokens
class-attribute
instance-attribute
¶
_output_token_ids
class-attribute
instance-attribute
¶
_output_token_ids: array = field(
default_factory=lambda: array(
VLLM_TOKEN_ID_ARRAY_TYPE, []
)
)
_prompt_token_ids_tuple
class-attribute
instance-attribute
¶
output_token_ids_array
property
¶
output_token_ids_array: array
Return the prompt token ids in array type.
Note that the array is in "I" type, and it is not compatible with torch.long (2 bytes vs 4 bytes). So beware of the usage.
prompt_token_ids_array
property
¶
prompt_token_ids_array: array
Return the prompt token ids in array type.
Note that the array is in "I" type, and it is not compatible with torch.long (2 bytes vs 4 bytes). So beware of the usage.
__post_init__
¶
Source code in vllm/sequence.py
__repr__
¶
__repr__() -> str
Source code in vllm/sequence.py
_update_cached_all_token_embeds
¶
Source code in vllm/sequence.py
_update_cached_all_tokens
¶
append_token_id
¶
Source code in vllm/sequence.py
apply_delta
¶
apply_delta(delta: SequenceDataDelta)
Source code in vllm/sequence.py
from_prompt_token_counts
staticmethod
¶
from_prompt_token_counts(
*token_counts: tuple[int, int],
) -> SequenceData
Construct a SequenceData
instance
by concatenating prompt token sequences.
Each tuple represents one token sequence, expressed in the form
(token_id, count)
.
Source code in vllm/sequence.py
from_seqs
staticmethod
¶
from_seqs(
prompt_token_ids: Sequence[int],
output_token_ids: Optional[Sequence[int]] = None,
*,
prompt_embeds: Optional[Tensor] = None,
) -> SequenceData
Construct a SequenceData
instance
from prompt and output token sequences.
Source code in vllm/sequence.py
get_delta_and_reset
¶
get_delta_and_reset() -> SequenceDataDelta
get_num_uncomputed_tokens
¶
get_num_uncomputed_tokens() -> int
Return the number of prefill tokens that are not computed.
Source code in vllm/sequence.py
get_output_token_ids
¶
get_prefix_token_ids
¶
Get prefix tokens, and make the return value hashable
Source code in vllm/sequence.py
get_prompt_token_ids
¶
get_token_embeddings
¶
get_token_ids
¶
reset_state_for_recompute
¶
Reset the number of computed tokens from this sequence. It is supposed to be called when a sequence needs to be started from the beginning again (e.g., sequence is preempted).
Source code in vllm/sequence.py
update_num_computed_tokens
¶
update_num_computed_tokens(num_new_computed_tokens: int)
Update number of tokens computed so far.
Source code in vllm/sequence.py
SequenceDataDelta
¶
Bases: Struct
Delta SequenceData to send to workers per step.
Source code in vllm/sequence.py
SequenceGroup
¶
A group of sequences that are generated from the same prompt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_id
|
str
|
The ID of the request. |
required |
seqs
|
list[Sequence]
|
The list of sequences. |
required |
sampling_params
|
Optional[SamplingParams]
|
The sampling parameters used to generate the outputs. |
None
|
arrival_time
|
float
|
The arrival time of the request. |
required |
lora_request
|
Optional[LoRARequest]
|
LoRA request. |
None
|
pooling_params
|
Optional[PoolingParams]
|
The parameters used to generate the pooler for a pooling model. |
None
|
pooled_data
|
Optional[Tensor]
|
The extracted hidden states from a pooling model. |
None
|
encoder_seq
|
Optional[Sequence]
|
Optional, the single encoder sequence. Should be None unless you are working with an encoder/decoder model. |
None
|
trace_headers
|
Optional[Mapping[str, str]]
|
OpenTelemetry trace headers. |
None
|
prompt_adapter_request
|
Optional[PromptAdapterRequest]
|
Prompt Adapter request. |
None
|
priority
|
int
|
User-defined priority of the request. |
0
|
draft_size
|
int
|
The number of speculative tokens plus one from the target model; equal to max number of tokens a step can generate for single-draft speculative decoding but larger than that for multi-draft SD (currently not supported). |
1
|
Source code in vllm/sequence.py
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
|
metrics
instance-attribute
¶
metrics = RequestMetrics(
arrival_time=arrival_time,
last_token_time=arrival_time,
first_scheduled_time=None,
first_token_time=None,
time_in_queue=None,
spec_token_acceptance_counts=[0] * draft_size,
)
__init__
¶
__init__(
request_id: str,
seqs: list[Sequence],
arrival_time: float,
sampling_params: Optional[SamplingParams] = None,
lora_request: Optional[LoRARequest] = None,
pooling_params: Optional[PoolingParams] = None,
pooled_data: Optional[Tensor] = None,
encoder_seq: Optional[Sequence] = None,
trace_headers: Optional[Mapping[str, str]] = None,
prompt_adapter_request: Optional[
PromptAdapterRequest
] = None,
priority: int = 0,
draft_size: int = 1,
) -> None
Source code in vllm/sequence.py
get_encoder_seq
¶
get_finished_seqs
¶
get_last_token_latency
¶
get_last_token_latency() -> float
Returns the latency of the last token.
Source code in vllm/sequence.py
get_max_num_running_seqs
¶
get_max_num_running_seqs() -> int
The maximum number of sequences running in parallel in the remaining lifetime of the request.
Source code in vllm/sequence.py
get_seqs
¶
get_seqs(
status: Optional[SequenceStatus] = None,
) -> list[Sequence]
Source code in vllm/sequence.py
init_multi_step_from_lookahead_slots
¶
init_multi_step_from_lookahead_slots(
num_lookahead_slots: int,
num_scheduler_steps: int,
is_multi_step: bool,
enable_chunking: bool,
) -> None
Source code in vllm/sequence.py
maybe_set_first_scheduled_time
¶
maybe_set_first_scheduled_time(time: float) -> None
Sets the first scheduled time and time in queue for Request level timings.
Source code in vllm/sequence.py
maybe_set_first_token_time
¶
maybe_set_first_token_time(time: float) -> None
Sets the first token time for Request level timings.
Source code in vllm/sequence.py
num_seqs
¶
num_seqs(status: Optional[SequenceStatus] = None) -> int
Source code in vllm/sequence.py
set_finished_time
¶
set_last_token_time
¶
set_last_token_time(now: float) -> None
Sets the last token time for Request level timings.
Source code in vllm/sequence.py
update_num_computed_tokens
¶
update_num_computed_tokens(num_new_computed_tokens: int)
Update number of tokens computed so far.
SequenceGroupBase
dataclass
¶
Source code in vllm/sequence.py
assembled_seq_group
class-attribute
instance-attribute
¶
assembled_seq_group: Optional[SequenceGroup] = None
finished_reqs
class-attribute
instance-attribute
¶
finished_reqs: dict[str, SequenceGroup] = field(
default_factory=dict
)
seq_id_to_index
class-attribute
instance-attribute
¶
to_be_finished
class-attribute
instance-attribute
¶
to_be_finished: dict[str, SequenceGroup] = field(
default_factory=dict
)
__init__
¶
__init__(
group_id: str,
assembled_seq_group: Optional[SequenceGroup] = None,
seq_id_to_index: dict[str, int] = dict(),
to_be_finished: dict[str, SequenceGroup] = dict(),
finished_reqs: dict[str, SequenceGroup] = dict(),
streaming: bool = False,
output_produced: bool = False,
) -> None
add_request
staticmethod
¶
add_request(
request_id: str, engine, params, *args, **kwargs
)
When we are ready to add a request with request_id and params into the engine, we can split the request into multiple requests.
Source code in vllm/sequence.py
finish_seq
¶
finish_seq(seq: SequenceGroup)
The sequence seq
finishes, we should record the information.
maybe_assemble_group
¶
maybe_assemble_group(
seq_group: SequenceGroup,
) -> Optional[SequenceGroup]
Assemble the sequence group, for producing the final output, or adding request in the engine again.
SequenceGroupMetadata
¶
Bases: Struct
Metadata for a sequence group. Used to create AttentionMetadata
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_id
|
The ID of the request. |
required | |
is_prompt
|
Whether the request is at prompt stage. |
required | |
seq_data
|
The sequence data. (Seq id -> sequence data) |
required | |
sampling_params
|
The sampling parameters used to generate the outputs. |
required | |
block_tables
|
The block tables. (Seq id -> list of physical block numbers) |
required | |
do_sample
|
True if sampling is required. Sampling is not required when e.g., prefill is chunked, and the current iteration only computes query tokens for prefill, we don't need sampling. |
required | |
token_chunk_size
|
The number of tokens to be processed (per sequence). None if chunking is not required. |
required | |
lora_request
|
LoRA request. |
required | |
computed_block_nums
|
The block numbers that are already computed, used in prefix caching. |
required | |
state
|
Internal state tied to this sequence group. |
required | |
multi_modal_data
|
Multi modal data. |
required | |
mm_processor_kwargs
|
Multimodal input processor / mapper overrides. |
required | |
encoder_seq_data
|
Optional sequence data for encoder prompt (SequenceGroup.encoder_seq). Should be None unless you are working with an encoder/decoder model. |
required | |
cross_block_table
|
Optional cross-attention block table associated with the encoder prompt (SequenceGroup.encoder_seq). Should be None unless you are working with an encoder/decoder model. |
required | |
prompt_adapter_request
|
Prompt Adapter request. |
required |
Source code in vllm/sequence.py
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 |
|
computed_block_nums
class-attribute
instance-attribute
¶
cross_block_table
class-attribute
instance-attribute
¶
encoder_seq_data
class-attribute
instance-attribute
¶
encoder_seq_data: Optional[SequenceData] = None
multi_modal_data
class-attribute
instance-attribute
¶
multi_modal_data: Optional[MultiModalKwargs] = None
multi_modal_placeholders
class-attribute
instance-attribute
¶
multi_modal_placeholders: Optional[
MultiModalPlaceholderDict
] = None
num_speculative_tokens
class-attribute
instance-attribute
¶
prompt_adapter_request
class-attribute
instance-attribute
¶
prompt_adapter_request: Optional[PromptAdapterRequest] = (
None
)
state
class-attribute
instance-attribute
¶
state: Optional[SequenceGroupState] = field(
default_factory=lambda: SequenceGroupState()
)
__post_init__
¶
apply_delta
¶
apply_delta(
sequence_group_metadata_delta: SequenceGroupMetadataDelta,
)
Source code in vllm/sequence.py
finish_step
¶
SequenceGroupMetadataDelta
¶
Bases: Struct
Delta of SequenceGroupMetadata.
After sending the first SequenceGroupMetadata, vLLM scheduler only sends delta to reduce the data payload size.
Source code in vllm/sequence.py
computed_block_nums
class-attribute
instance-attribute
¶
state
class-attribute
instance-attribute
¶
state: Optional[SequenceGroupState] = field(
default_factory=lambda: SequenceGroupState()
)
SequenceGroupOutput
¶
Bases: ABC
The base class for model outputs associated with a sequence group.
Source code in vllm/sequence.py
SequenceGroupState
¶
Bases: Struct
Mutable state tied to a specific sequence group
Source code in vllm/sequence.py
SequenceOutput
¶
Bases: Struct
The model output associated with a sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_seq_id
|
The ID of the parent sequence (for forking in beam search). |
required | |
output_token
|
The output token ID. |
required | |
logprobs
|
The logprobs of the output token. (Token id -> logP(x_i+1 | x_0, ..., x_i)) |
required |
Source code in vllm/sequence.py
SequenceStage
¶
SequenceStatus
¶
Bases: IntEnum
Status of a sequence.
Source code in vllm/sequence.py
get_finished_reason
staticmethod
¶
get_finished_reason(
status: SequenceStatus,
) -> Union[str, None]
Source code in vllm/sequence.py
array_full
¶
array
equivalent of numpy.full.
get_all_seq_ids
¶
get_all_seq_ids(
seq_group_metadata_list: list[SequenceGroupMetadata],
) -> list[int]
Given a list of SequenceGroupMetadata, create a list of all sequence ids.
Source code in vllm/sequence.py
get_all_seq_ids_and_request_ids
¶
get_all_seq_ids_and_request_ids(
seq_group_metadata_list: list[SequenceGroupMetadata],
) -> tuple[list[int], dict[str, set[int]]]
Given a list of SequenceGroupMetadata, create a list of all sequence ids.