vllm_mlx.mllm_scheduler¶
MLLM Scheduler for multimodal continuous batching.
View the complete module source at #L1-L1242.
API details¶
Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.
vllm_mlx.mllm_scheduler
¶
MLLM Scheduler for multimodal continuous batching.
This scheduler handles Multimodal Language Model requests with continuous batching support, following the same architecture as the LLM scheduler.
Key features: - Batch processing of multiple MLLM requests - Vision embedding caching for repeated images - Step-based generation loop (like LLM scheduler) - Support for both streaming and non-streaming generation
Architecture: 1. Requests arrive via add_request() -> waiting queue 2. Scheduler moves requests from waiting to running (via MLLMBatchGenerator) 3. step() method generates one token for ALL running requests 4. Finished requests are removed and outputs returned
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig
dataclass
¶
MLLMSchedulerConfig(max_num_seqs: int = 16, prefill_batch_size: int = 16, completion_batch_size: int = 16, prefill_step_size: int = 1024, enable_vision_cache: bool = True, vision_cache_size: int = 100, default_max_tokens: int = 256, default_video_fps: float = 2.0, cache_memory_mb: Optional[int] = None, max_video_frames: int = 128, enable_mtp: bool = False, mtp_num_draft_tokens: int = 1, enable_prefix_cache: bool = True, use_memory_aware_cache: bool = True, prefix_cache_memory_mb: Optional[int] = None, kv_cache_quantization: bool = False, kv_cache_quantization_bits: int = 8, kv_cache_quantization_group_size: int = 64, chunked_prefill_tokens: int = 0, max_kv_size: int = 0, ssd_cache_dir: Optional[str] = None, ssd_cache_max_gb: float = 10.0)
Configuration for MLLM scheduler.
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.max_num_seqs
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.prefill_batch_size
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.completion_batch_size
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.prefill_step_size
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.enable_vision_cache
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.vision_cache_size
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.default_max_tokens
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.default_video_fps
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.cache_memory_mb
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.max_video_frames
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.enable_mtp
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.mtp_num_draft_tokens
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.enable_prefix_cache
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.use_memory_aware_cache
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.prefix_cache_memory_mb
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.kv_cache_quantization
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.kv_cache_quantization_bits
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.kv_cache_quantization_group_size
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.chunked_prefill_tokens
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.max_kv_size
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.ssd_cache_dir
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig.ssd_cache_max_gb
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest
dataclass
¶
MLLMRequest(request_id: str, prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, sampling_params: SamplingParams = SamplingParams(), arrival_time: float = time(), batch_uid: Optional[int] = None, status: RequestStatus = WAITING, output_text: str = '', output_tokens: List[int] = list(), finish_reason: Optional[str] = None, num_prompt_tokens: int = 0, num_output_tokens: int = 0, mtp_drafts: int = 0, mtp_accepted: int = 0, first_token_time: Optional[float] = None)
Extended request for MLLM processing.
Includes all multimodal data needed for generation.
vllm_mlx.mllm_scheduler.MLLMRequest.images
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.videos
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.audio
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.sampling_params
class-attribute
instance-attribute
¶
sampling_params: SamplingParams = field(default_factory=SamplingParams)
vllm_mlx.mllm_scheduler.MLLMRequest.arrival_time
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.batch_uid
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.status
class-attribute
instance-attribute
¶
status: RequestStatus = RequestStatus.WAITING
vllm_mlx.mllm_scheduler.MLLMRequest.output_text
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.output_tokens
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.finish_reason
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.num_prompt_tokens
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.num_output_tokens
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.mtp_drafts
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.mtp_accepted
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMRequest.first_token_time
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerOutput
dataclass
¶
MLLMSchedulerOutput(scheduled_request_ids: List[str] = list(), num_scheduled_tokens: int = 0, finished_request_ids: Set[str] = set(), outputs: List[RequestOutput] = list(), has_work: bool = False)
Output from a scheduling step.
Contains information about what was scheduled and results.
vllm_mlx.mllm_scheduler.MLLMSchedulerOutput.scheduled_request_ids
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerOutput.num_scheduled_tokens
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerOutput.finished_request_ids
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMSchedulerOutput.outputs
class-attribute
instance-attribute
¶
outputs: List[RequestOutput] = field(default_factory=list)
vllm_mlx.mllm_scheduler.MLLMSchedulerOutput.has_work
class-attribute
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler
¶
MLLMScheduler(model: Any, processor: Any, config: Optional[MLLMSchedulerConfig] = None)
Scheduler for Vision Language Model requests with continuous batching.
This scheduler manages the lifecycle of MLLM requests using the MLLMBatchGenerator for efficient batch processing:
- Requests arrive and are added to the waiting queue
- Scheduler moves requests from waiting to running (via batch generator)
- step() generates one token for ALL running requests simultaneously
- Finished requests are removed and outputs returned
Example
scheduler = MLLMScheduler(model, processor, config)
Add requests¶
request_id = scheduler.add_request( ... prompt="What's in this image?", ... images=["photo.jpg"] ... )
Run generation loop¶
while scheduler.has_requests(): ... output = scheduler.step() ... for req_output in output.outputs: ... if req_output.finished: ... print(f"Finished: {req_output.output_text}")
For async usage with streaming
await scheduler.start() request_id = await scheduler.add_request_async(...) async for output in scheduler.stream_outputs(request_id): ... print(output.new_text, end="")
Initialize MLLM scheduler.
Parameters:
-
model(Any) –The VLM model
-
processor(Any) –The VLM processor
-
config(Optional[MLLMSchedulerConfig], default:None) –Scheduler configuration
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler.config
instance-attribute
¶
config = config or MLLMSchedulerConfig()
vllm_mlx.mllm_scheduler.MLLMScheduler.model_config
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.mm_processor
instance-attribute
¶
mm_processor = MultimodalProcessor(model=model, processor=processor, config=self.model_config)
vllm_mlx.mllm_scheduler.MLLMScheduler.stop_tokens
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.batch_generator
instance-attribute
¶
batch_generator: Optional[MLLMBatchGenerator] = None
vllm_mlx.mllm_scheduler.MLLMScheduler.waiting
instance-attribute
¶
waiting: deque[MLLMRequest] = deque()
vllm_mlx.mllm_scheduler.MLLMScheduler.running
instance-attribute
¶
running: Dict[str, MLLMRequest] = {}
vllm_mlx.mllm_scheduler.MLLMScheduler.requests
instance-attribute
¶
requests: Dict[str, MLLMRequest] = {}
vllm_mlx.mllm_scheduler.MLLMScheduler.finished_req_ids
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.request_id_to_uid
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.uid_to_request_id
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler._detokenizer_pool
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.output_queues
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler._processing_task
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.num_requests_processed
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.total_prompt_tokens
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.total_completion_tokens
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler._clear_cache_interval
instance-attribute
¶
vllm_mlx.mllm_scheduler.MLLMScheduler._get_stop_tokens
¶
Get stop token IDs from tokenizer and generation_config.json.
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler._ensure_batch_generator
¶
Ensure batch generator exists.
Source code in vllm_mlx/mllm_scheduler.py
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 | |
vllm_mlx.mllm_scheduler.MLLMScheduler.add_request
¶
add_request(prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, max_tokens: int = 256, temperature: float = 0.7, top_p: float = 0.9, request_id: Optional[str] = None, **kwargs) -> str
Add a multimodal request to the scheduler (sync version).
Parameters:
-
prompt(str) –Text prompt (should be formatted with chat template)
-
images(Optional[List[str]], default:None) –List of image inputs (paths, URLs, base64)
-
videos(Optional[List[str]], default:None) –List of video inputs
-
audio(Optional[List[str]], default:None) –List of audio inputs
-
max_tokens(int, default:256) –Maximum tokens to generate
-
temperature(float, default:0.7) –Sampling temperature
-
top_p(float, default:0.9) –Top-p sampling
-
request_id(Optional[str], default:None) –Optional custom request ID
-
**kwargs–Additional generation parameters.
logits_processors— list of callables(tokens, logits) -> logitsapplied during sampling (e.g. constrained JSON decoding).
Returns:
-
str–Request ID for tracking
Source code in vllm_mlx/mllm_scheduler.py
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 451 452 453 | |
vllm_mlx.mllm_scheduler.MLLMScheduler.abort_request
¶
Abort a request.
Parameters:
-
request_id(str) –The request ID to abort
Returns:
-
bool–True if request was found and aborted
Source code in vllm_mlx/mllm_scheduler.py
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 | |
vllm_mlx.mllm_scheduler.MLLMScheduler.has_requests
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.get_num_waiting
¶
vllm_mlx.mllm_scheduler.MLLMScheduler.get_num_running
¶
vllm_mlx.mllm_scheduler.MLLMScheduler._schedule_waiting
¶
_schedule_waiting() -> List[MLLMRequest]
Move requests from waiting queue to running.
Returns:
-
List[MLLMRequest]–List of requests that were scheduled
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler._process_batch_responses
¶
_process_batch_responses(responses: List[MLLMBatchResponse]) -> Tuple[List[RequestOutput], Set[str]]
Process responses from batch generator.
Parameters:
-
responses(List[MLLMBatchResponse]) –List of MLLMBatchResponse objects
Returns:
-
Tuple[List[RequestOutput], Set[str]]–Tuple of (outputs, finished_request_ids)
Source code in vllm_mlx/mllm_scheduler.py
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 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |
vllm_mlx.mllm_scheduler.MLLMScheduler._cleanup_finished
¶
Clean up finished requests.
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler.step
¶
step() -> MLLMSchedulerOutput
Execute one scheduling step.
This method: 1. Schedules waiting requests into the batch 2. Runs one generation step via MLLMBatchGenerator 3. Processes outputs and handles finished requests
Returns:
-
MLLMSchedulerOutput–MLLMSchedulerOutput with results of this step
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler.get_request
¶
get_request(request_id: str) -> Optional[MLLMRequest]
vllm_mlx.mllm_scheduler.MLLMScheduler.remove_finished_request
¶
remove_finished_request(request_id: str) -> Optional[MLLMRequest]
vllm_mlx.mllm_scheduler.MLLMScheduler.start
async
¶
Start the async scheduler processing loop.
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler.stop
async
¶
Stop the scheduler.
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler._process_loop
async
¶
Main async processing loop.
MLLM models are loaded on the server/event-loop thread, so their MLX arrays and cache state must be consumed on that same thread. Unlike the text-only EngineCore path, moving MLLM prefill to a worker crosses MLX stream ownership and can fail with "no Stream in current thread".
Text-only preprocessing (Jinja2 template rendering + tokenization) is
run BEFORE step() with await asyncio.sleep(0) yields between
each request. This prevents long preprocessing (10-30+ s for 40K+
token conversations) from blocking health checks and new connections.
Source code in vllm_mlx/mllm_scheduler.py
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 | |
vllm_mlx.mllm_scheduler.MLLMScheduler.add_request_async
async
¶
add_request_async(prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, max_tokens: int = 256, temperature: float = 0.7, top_p: float = 0.9, **kwargs) -> str
Add a multimodal request (async version with output queue).
Parameters:
-
prompt(str) –Text prompt
-
images(Optional[List[str]], default:None) –List of image inputs
-
videos(Optional[List[str]], default:None) –List of video inputs
-
audio(Optional[List[str]], default:None) –List of audio inputs
-
max_tokens(int, default:256) –Maximum tokens to generate
-
temperature(float, default:0.7) –Sampling temperature
-
top_p(float, default:0.9) –Top-p sampling
-
**kwargs–Additional parameters
Returns:
-
str–Request ID for tracking
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler.stream_outputs
async
¶
stream_outputs(request_id: str) -> AsyncIterator[RequestOutput]
Stream outputs for a request.
Parameters:
-
request_id(str) –The request ID to stream
Yields:
-
AsyncIterator[RequestOutput]–RequestOutput objects as tokens are generated
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler.generate
async
¶
generate(prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, **kwargs) -> RequestOutput
Generate complete output for a request (non-streaming).
Parameters:
-
prompt(str) –Text prompt
-
images(Optional[List[str]], default:None) –Image inputs
-
videos(Optional[List[str]], default:None) –Video inputs
-
audio(Optional[List[str]], default:None) –Audio inputs
-
**kwargs–Generation parameters
Returns:
-
RequestOutput–Final RequestOutput
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler.get_running_requests_info
¶
Per-request details for status endpoint.
Source code in vllm_mlx/mllm_scheduler.py
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | |
vllm_mlx.mllm_scheduler.MLLMScheduler.get_stats
¶
Get scheduler statistics.
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler.clear_runtime_caches
¶
Clear runtime caches without resetting scheduler/request state.
Source code in vllm_mlx/mllm_scheduler.py
vllm_mlx.mllm_scheduler.MLLMScheduler.reset
¶
Reset the scheduler state.
Source code in vllm_mlx/mllm_scheduler.py
Complete contract reference¶
Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig · class
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig(max_num_seqs: int = 16, prefill_batch_size: int = 16, completion_batch_size: int = 16, prefill_step_size: int = 1024, enable_vision_cache: bool = True, vision_cache_size: int = 100, default_max_tokens: int = 256, default_video_fps: float = 2.0, cache_memory_mb: Optional[int] = None, max_video_frames: int = 128, enable_mtp: bool = False, mtp_num_draft_tokens: int = 1, enable_prefix_cache: bool = True, use_memory_aware_cache: bool = True, prefix_cache_memory_mb: Optional[int] = None, kv_cache_quantization: bool = False, kv_cache_quantization_bits: int = 8, kv_cache_quantization_group_size: int = 64, chunked_prefill_tokens: int = 0, max_kv_size: int = 0, ssd_cache_dir: Optional[str] = None, ssd_cache_max_gb: float = 10.0)
Configuration for MLLM scheduler.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
max_num_seqs |
int |
no |
16 |
Optional constructor field; defaults to 16. |
prefill_batch_size |
int |
no |
16 |
Optional constructor field; defaults to 16. |
completion_batch_size |
int |
no |
16 |
Optional constructor field; defaults to 16. |
prefill_step_size |
int |
no |
1024 |
Optional constructor field; defaults to 1024. |
enable_vision_cache |
bool |
no |
True |
Optional constructor field; defaults to True. |
vision_cache_size |
int |
no |
100 |
Optional constructor field; defaults to 100. |
default_max_tokens |
int |
no |
256 |
Optional constructor field; defaults to 256. |
default_video_fps |
float |
no |
2.0 |
Optional constructor field; defaults to 2.0. |
cache_memory_mb |
Optional[int] |
no |
None |
Optional constructor field; defaults to None. |
max_video_frames |
int |
no |
128 |
Optional constructor field; defaults to 128. |
enable_mtp |
bool |
no |
False |
Optional constructor field; defaults to False. |
mtp_num_draft_tokens |
int |
no |
1 |
Optional constructor field; defaults to 1. |
enable_prefix_cache |
bool |
no |
True |
Optional constructor field; defaults to True. |
use_memory_aware_cache |
bool |
no |
True |
Optional constructor field; defaults to True. |
prefix_cache_memory_mb |
Optional[int] |
no |
None |
Optional constructor field; defaults to None. |
kv_cache_quantization |
bool |
no |
False |
Optional constructor field; defaults to False. |
kv_cache_quantization_bits |
int |
no |
8 |
Optional constructor field; defaults to 8. |
kv_cache_quantization_group_size |
int |
no |
64 |
Optional constructor field; defaults to 64. |
chunked_prefill_tokens |
int |
no |
0 |
Optional constructor field; defaults to 0. |
max_kv_size |
int |
no |
0 |
Optional constructor field; defaults to 0. |
ssd_cache_dir |
Optional[str] |
no |
None |
Optional constructor field; defaults to None. |
ssd_cache_max_gb |
float |
no |
10.0 |
Optional constructor field; defaults to 10.0. |
Returns
- Constructs:
vllm_mlx.mllm_scheduler.MLLMSchedulerConfig
Exceptions and behavior
Class MLLMSchedulerConfig declares 0 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMRequest · class
vllm_mlx.mllm_scheduler.MLLMRequest(request_id: str, prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, sampling_params: SamplingParams = field(default_factory=SamplingParams), arrival_time: float = field(default_factory=time.time), batch_uid: Optional[int] = None, status: RequestStatus = RequestStatus.WAITING, output_text: str = '', output_tokens: List[int] = field(default_factory=list), finish_reason: Optional[str] = None, num_prompt_tokens: int = 0, num_output_tokens: int = 0, mtp_drafts: int = 0, mtp_accepted: int = 0, first_token_time: Optional[float] = None)
Extended request for MLLM processing.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
request_id |
str |
yes |
none |
Required constructor field. |
prompt |
str |
yes |
none |
Required constructor field. |
images |
Optional[List[str]] |
no |
None |
Optional constructor field; defaults to None. |
videos |
Optional[List[str]] |
no |
None |
Optional constructor field; defaults to None. |
audio |
Optional[List[str]] |
no |
None |
Optional constructor field; defaults to None. |
sampling_params |
SamplingParams |
no |
field(default_factory=SamplingParams) |
Optional constructor field; defaults to field(default_factory=SamplingParams). |
arrival_time |
float |
no |
field(default_factory=time.time) |
Optional constructor field; defaults to field(default_factory=time.time). |
batch_uid |
Optional[int] |
no |
None |
Optional constructor field; defaults to None. |
status |
RequestStatus |
no |
RequestStatus.WAITING |
Optional constructor field; defaults to RequestStatus.WAITING. |
output_text |
str |
no |
'' |
Optional constructor field; defaults to ''. |
output_tokens |
List[int] |
no |
field(default_factory=list) |
Optional constructor field; defaults to field(default_factory=list). |
finish_reason |
Optional[str] |
no |
None |
Optional constructor field; defaults to None. |
num_prompt_tokens |
int |
no |
0 |
Optional constructor field; defaults to 0. |
num_output_tokens |
int |
no |
0 |
Optional constructor field; defaults to 0. |
mtp_drafts |
int |
no |
0 |
Optional constructor field; defaults to 0. |
mtp_accepted |
int |
no |
0 |
Optional constructor field; defaults to 0. |
first_token_time |
Optional[float] |
no |
None |
Optional constructor field; defaults to None. |
Returns
- Constructs:
vllm_mlx.mllm_scheduler.MLLMRequest
Exceptions and behavior
Class MLLMRequest declares 0 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMSchedulerOutput · class
vllm_mlx.mllm_scheduler.MLLMSchedulerOutput(scheduled_request_ids: List[str] = field(default_factory=list), num_scheduled_tokens: int = 0, finished_request_ids: Set[str] = field(default_factory=set), outputs: List[RequestOutput] = field(default_factory=list), has_work: bool = False)
Output from a scheduling step.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
scheduled_request_ids |
List[str] |
no |
field(default_factory=list) |
Optional constructor field; defaults to field(default_factory=list). |
num_scheduled_tokens |
int |
no |
0 |
Optional constructor field; defaults to 0. |
finished_request_ids |
Set[str] |
no |
field(default_factory=set) |
Optional constructor field; defaults to field(default_factory=set). |
outputs |
List[RequestOutput] |
no |
field(default_factory=list) |
Optional constructor field; defaults to field(default_factory=list). |
has_work |
bool |
no |
False |
Optional constructor field; defaults to False. |
Returns
- Constructs:
vllm_mlx.mllm_scheduler.MLLMSchedulerOutput
Exceptions and behavior
Class MLLMSchedulerOutput declares 0 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler · class
vllm_mlx.mllm_scheduler.MLLMScheduler(model: Any, processor: Any, config: Optional[MLLMSchedulerConfig] = None)
Scheduler for Vision Language Model requests with continuous batching.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
model |
Any |
yes |
none |
The VLM model |
processor |
Any |
yes |
none |
The VLM processor |
config |
Optional[MLLMSchedulerConfig] |
no |
None |
Scheduler configuration |
Returns
- Constructs:
vllm_mlx.mllm_scheduler.MLLMScheduler
Exceptions and behavior
Class MLLMScheduler declares 24 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.__init__ · method
vllm_mlx.mllm_scheduler.MLLMScheduler.__init__(model: Any, processor: Any, config: Optional[MLLMSchedulerConfig] = None) -> not annotated
Initialize MLLM scheduler.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
model |
Any |
yes |
none |
The VLM model |
processor |
Any |
yes |
none |
The VLM processor |
config |
Optional[MLLMSchedulerConfig] |
no |
None |
Scheduler configuration |
Returns
- Type:
not annotated
Exceptions and behavior
Method MLLMScheduler.__init__ updates self.model, self.processor, self.config, self.model_config; calls MLLMSchedulerConfig, getattr, MultimodalProcessor, self._get_stop_tokens.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler._get_stop_tokens · method
Get stop token IDs from tokenizer and generation_config.json.
Parameters
This callable has no explicit inputs.
Returns
- Type:
Set[int] - Direct return expressions:
stop_tokens
Exceptions and behavior
Method MLLMScheduler._get_stop_tokens calls set, hasattr, isinstance, stop_tokens.update; returns stop_tokens.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler._ensure_batch_generator · method
Ensure batch generator exists.
Parameters
This callable has no explicit inputs.
Returns
- Type:
None
Exceptions and behavior
Method MLLMScheduler._ensure_batch_generator updates self.batch_generator, self._ssd_tier; calls make_sampler, MemoryCacheConfig, MLLMBatchGenerator, getattr.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.add_request · method
vllm_mlx.mllm_scheduler.MLLMScheduler.add_request(prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, max_tokens: int = 256, temperature: float = 0.7, top_p: float = 0.9, request_id: Optional[str] = None, **kwargs) -> str
Add a multimodal request to the scheduler (sync version).
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
prompt |
str |
yes |
none |
Text prompt (should be formatted with chat template) |
images |
Optional[List[str]] |
no |
None |
List of image inputs (paths, URLs, base64) |
videos |
Optional[List[str]] |
no |
None |
List of video inputs |
audio |
Optional[List[str]] |
no |
None |
List of audio inputs |
max_tokens |
int |
no |
256 |
Maximum tokens to generate |
temperature |
float |
no |
0.7 |
Sampling temperature |
top_p |
float |
no |
0.9 |
Top-p sampling |
request_id |
Optional[str] |
no |
None |
Optional custom request ID |
**kwargs |
not annotated |
no |
none |
Additional generation parameters. logits_processors — list of callables (tokens, logits) -> logits applied during sampling (e.g. constrained JSON decoding). |
Returns
- Type:
str - Direct return expressions:
request_id
Exceptions and behavior
Method MLLMScheduler.add_request calls str, uuid.uuid4, SamplingParams, kwargs.pop; returns request_id.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.abort_request · method
Abort a request.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
request_id |
str |
yes |
none |
The request ID to abort |
Returns
- Type:
bool - Direct return expressions:
False;True
Exceptions and behavior
Method MLLMScheduler.abort_request updates self.total_completion_tokens, self.total_prompt_tokens; calls self.requests.get, self.batch_generator.abort_prefill, self.waiting.remove, self.batch_generator.schedule_removal; has 2 explicit return paths.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.has_requests · method
Check if there are any pending or running requests.
Parameters
This callable has no explicit inputs.
Returns
- Type:
bool - Direct return expressions:
bool(self.waiting or self.running)
Exceptions and behavior
Method MLLMScheduler.has_requests calls bool; returns bool(self.waiting or self.running).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.get_num_waiting · method
Get number of waiting requests.
Parameters
This callable has no explicit inputs.
Returns
- Type:
int - Direct return expressions:
len(self.waiting)
Exceptions and behavior
Method MLLMScheduler.get_num_waiting calls len; returns len(self.waiting).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.get_num_running · method
Get number of running requests.
Parameters
This callable has no explicit inputs.
Returns
- Type:
int - Direct return expressions:
len(self.running)
Exceptions and behavior
Method MLLMScheduler.get_num_running calls len; returns len(self.running).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler._schedule_waiting · method
Move requests from waiting queue to running.
Parameters
This callable has no explicit inputs.
Returns
- Type:
List[MLLMRequest] - Direct return expressions:
scheduled
Exceptions and behavior
Method MLLMScheduler._schedule_waiting updates self.total_prompt_tokens; calls self._ensure_batch_generator, len, self.waiting.popleft, MLLMBatchRequest; returns scheduled.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler._process_batch_responses · method
vllm_mlx.mllm_scheduler.MLLMScheduler._process_batch_responses(responses: List[MLLMBatchResponse]) -> Tuple[List[RequestOutput], Set[str]]
Process responses from batch generator.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
responses |
List[MLLMBatchResponse] |
yes |
none |
List of MLLMBatchResponse objects |
Returns
- Type:
Tuple[List[RequestOutput], Set[str]] - Direct return expressions:
(outputs, finished_ids)
Exceptions and behavior
Method MLLMScheduler._process_batch_responses updates self.num_requests_processed, self.total_completion_tokens; calls set, hasattr, self.uid_to_request_id.get, self.running.get; returns (outputs, finished_ids).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler._cleanup_finished · method
Clean up finished requests.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
finished_ids |
Set[str] |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
None
Exceptions and behavior
Method MLLMScheduler._cleanup_finished calls self.requests.pop, self._detokenizer_pool.pop, self.finished_req_ids.add, mx.clear_cache.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.step · method
Execute one scheduling step.
Parameters
This callable has no explicit inputs.
Returns
- Type:
MLLMSchedulerOutput - Direct return expressions:
output
Exceptions and behavior
Method MLLMScheduler.step updates self._step_count, self.finished_req_ids; calls MLLMSchedulerOutput, self.batch_generator.process_pending_removals, self._schedule_waiting, sum; returns output.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.get_request · method
Get a request by ID.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
request_id |
str |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
Optional[MLLMRequest] - Direct return expressions:
self.requests.get(request_id)
Exceptions and behavior
Method MLLMScheduler.get_request calls self.requests.get; returns self.requests.get(request_id).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.remove_finished_request · method
vllm_mlx.mllm_scheduler.MLLMScheduler.remove_finished_request(request_id: str) -> Optional[MLLMRequest]
Remove a finished request from tracking.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
request_id |
str |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
Optional[MLLMRequest] - Direct return expressions:
self.requests.pop(request_id, None)
Exceptions and behavior
Method MLLMScheduler.remove_finished_request calls self.requests.pop; returns self.requests.pop(request_id, None).
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.start · method
Start the async scheduler processing loop.
Parameters
This callable has no explicit inputs.
Returns
- Type:
None - Direct return expressions:
None
Exceptions and behavior
Method MLLMScheduler.start updates self._running, self._processing_task; calls asyncio.create_task, self._process_loop, logger.info; returns None.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.stop · method
Stop the scheduler.
Parameters
This callable has no explicit inputs.
Returns
- Type:
None
Exceptions and behavior
Method MLLMScheduler.stop updates self._running, self.batch_generator; calls self._processing_task.cancel, self.batch_generator.close, logger.info; awaits asynchronous work.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler._process_loop · method
Main async processing loop.
Parameters
This callable has no explicit inputs.
Returns
- Type:
None
Exceptions and behavior
Method MLLMScheduler._process_loop calls asyncio.get_running_loop, list, getattr, time.perf_counter; awaits asynchronous work.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler._process_loop._ensure_streams_bound · nested function
Nested Function MLLMScheduler._process_loop._ensure_streams_bound calls bind_generation_streams.
Parameters
This callable has no explicit inputs.
Returns
- Type:
None
Exceptions and behavior
Nested Function MLLMScheduler._process_loop._ensure_streams_bound calls bind_generation_streams.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.add_request_async · method
async vllm_mlx.mllm_scheduler.MLLMScheduler.add_request_async(prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, max_tokens: int = 256, temperature: float = 0.7, top_p: float = 0.9, **kwargs) -> str
Add a multimodal request (async version with output queue).
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
prompt |
str |
yes |
none |
Text prompt |
images |
Optional[List[str]] |
no |
None |
List of image inputs |
videos |
Optional[List[str]] |
no |
None |
List of video inputs |
audio |
Optional[List[str]] |
no |
None |
List of audio inputs |
max_tokens |
int |
no |
256 |
Maximum tokens to generate |
temperature |
float |
no |
0.7 |
Sampling temperature |
top_p |
float |
no |
0.9 |
Top-p sampling |
**kwargs |
not annotated |
no |
none |
Additional parameters |
Returns
- Type:
str - Direct return expressions:
request_id
Exceptions and behavior
Method MLLMScheduler.add_request_async calls self.add_request, asyncio.Queue; returns request_id.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.stream_outputs · method
async vllm_mlx.mllm_scheduler.MLLMScheduler.stream_outputs(request_id: str) -> AsyncIterator[RequestOutput]
Stream outputs for a request.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
request_id |
str |
yes |
none |
The request ID to stream |
Returns
- Type:
AsyncIterator[RequestOutput] - Direct return expressions:
None - Yields values incrementally.
Exceptions and behavior
Method MLLMScheduler.stream_outputs calls self.output_queues.get, output_queue.get, logger.info, self.abort_request; awaits asynchronous work; yields values incrementally; returns None.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.generate · method
async vllm_mlx.mllm_scheduler.MLLMScheduler.generate(prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, **kwargs) -> RequestOutput
Generate complete output for a request (non-streaming).
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
prompt |
str |
yes |
none |
Text prompt |
images |
Optional[List[str]] |
no |
None |
Image inputs |
videos |
Optional[List[str]] |
no |
None |
Video inputs |
audio |
Optional[List[str]] |
no |
None |
Audio inputs |
**kwargs |
not annotated |
no |
none |
Generation parameters |
Returns
- Type:
RequestOutput - Direct return expressions:
final_output
Exceptions and behavior
Method MLLMScheduler.generate calls self.add_request_async, self.stream_outputs, RequestOutput; awaits asynchronous work; returns final_output.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.get_running_requests_info · method
Per-request details for status endpoint.
Parameters
This callable has no explicit inputs.
Returns
- Type:
List[Dict[str, Any]] - Direct return expressions:
result
Exceptions and behavior
Method MLLMScheduler.get_running_requests_info calls time.time, result.append, round, self.running.values; returns result.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.get_stats · method
Get scheduler statistics.
Parameters
This callable has no explicit inputs.
Returns
- Type:
Dict[str, Any] - Direct return expressions:
stats
Exceptions and behavior
Method MLLMScheduler.get_stats calls len, self.get_running_requests_info, self.batch_generator.stats, batch_stats.to_dict; returns stats.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.clear_runtime_caches · method
Clear runtime caches without resetting scheduler/request state.
Parameters
This callable has no explicit inputs.
Returns
- Type:
Dict[str, bool] - Direct return expressions:
cleared
Exceptions and behavior
Method MLLMScheduler.clear_runtime_caches calls self.vision_cache.clear, self.batch_generator.prefix_cache.clear; returns cleared.
No direct raise statement appears in this definition.
vllm_mlx.mllm_scheduler.MLLMScheduler.reset · method
Reset the scheduler state.
Parameters
This callable has no explicit inputs.
Returns
- Type:
None
Exceptions and behavior
Method MLLMScheduler.reset updates self.batch_generator; calls list, self.requests.keys, self.abort_request, self.waiting.clear.
No direct raise statement appears in this definition.
Complete symbol map¶
This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.
| Symbol | Kind | Signature and inputs | What it does | Source |
|---|---|---|---|---|
MLLMSchedulerConfig |
class | MLLMSchedulerConfig(max_num_seqs: int = 16, prefill_batch_size: int = 16, completion_batch_size: int = 16, prefill_step_size: int = 1024, enable_vision_cache: bool = True, vision_cache_size: int = 100, default_max_tokens: int = 256, default_video_fps: float = 2.0, cache_memory_mb: Optional[int] = None, max_video_frames: int = 128, enable_mtp: bool = False, mtp_num_draft_tokens: int = 1, enable_prefix_cache: bool = True, use_memory_aware_cache: bool = True, prefix_cache_memory_mb: Optional[int] = None, kv_cache_quantization: bool = False, kv_cache_quantization_bits: int = 8, kv_cache_quantization_group_size: int = 64, chunked_prefill_tokens: int = 0, max_kv_size: int = 0, ssd_cache_dir: Optional[str] = None, ssd_cache_max_gb: float = 10.0) |
Configuration for MLLM scheduler. | #L46-L92 |
MLLMRequest |
class | MLLMRequest(request_id: str, prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, sampling_params: SamplingParams = field(default_factory=SamplingParams), arrival_time: float = field(default_factory=time.time), batch_uid: Optional[int] = None, status: RequestStatus = RequestStatus.WAITING, output_text: str = '', output_tokens: List[int] = field(default_factory=list), finish_reason: Optional[str] = None, num_prompt_tokens: int = 0, num_output_tokens: int = 0, mtp_drafts: int = 0, mtp_accepted: int = 0, first_token_time: Optional[float] = None) |
Extended request for MLLM processing. | #L96-L127 |
MLLMSchedulerOutput |
class | MLLMSchedulerOutput(scheduled_request_ids: List[str] = field(default_factory=list), num_scheduled_tokens: int = 0, finished_request_ids: Set[str] = field(default_factory=set), outputs: List[RequestOutput] = field(default_factory=list), has_work: bool = False) |
Output from a scheduling step. | #L131-L147 |
MLLMScheduler |
class | MLLMScheduler(model: Any, processor: Any, config: Optional[MLLMSchedulerConfig] = None) |
Scheduler for Vision Language Model requests with continuous batching. | #L150-L1242 |
MLLMScheduler.__init__ |
method | MLLMScheduler.__init__(model: Any, processor: Any, config: Optional[MLLMSchedulerConfig] = None) -> not annotated |
Initialize MLLM scheduler. | #L183-L248 |
MLLMScheduler._get_stop_tokens |
method | MLLMScheduler._get_stop_tokens() -> Set[int] |
Get stop token IDs from tokenizer and generation_config.json. | #L250-L290 |
MLLMScheduler._ensure_batch_generator |
method | MLLMScheduler._ensure_batch_generator() -> None |
Ensure batch generator exists. | #L292-L374 |
MLLMScheduler.add_request |
method | MLLMScheduler.add_request(prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, max_tokens: int = 256, temperature: float = 0.7, top_p: float = 0.9, request_id: Optional[str] = None, **kwargs) -> str |
Add a multimodal request to the scheduler (sync version). | #L378-L453 |
MLLMScheduler.abort_request |
method | MLLMScheduler.abort_request(request_id: str) -> bool |
Abort a request. | #L455-L532 |
MLLMScheduler.has_requests |
method | MLLMScheduler.has_requests() -> bool |
Check if there are any pending or running requests. | #L534-L536 |
MLLMScheduler.get_num_waiting |
method | MLLMScheduler.get_num_waiting() -> int |
Get number of waiting requests. | #L538-L540 |
MLLMScheduler.get_num_running |
method | MLLMScheduler.get_num_running() -> int |
Get number of running requests. | #L542-L544 |
MLLMScheduler._schedule_waiting |
method | MLLMScheduler._schedule_waiting() -> List[MLLMRequest] |
Move requests from waiting queue to running. | #L546-L597 |
MLLMScheduler._process_batch_responses |
method | MLLMScheduler._process_batch_responses(responses: List[MLLMBatchResponse]) -> Tuple[List[RequestOutput], Set[str]] |
Process responses from batch generator. | #L599-L716 |
MLLMScheduler._cleanup_finished |
method | MLLMScheduler._cleanup_finished(finished_ids: Set[str]) -> None |
Clean up finished requests. | #L718-L744 |
MLLMScheduler.step |
method | MLLMScheduler.step() -> MLLMSchedulerOutput |
Execute one scheduling step. | #L746-L813 |
MLLMScheduler.get_request |
method | MLLMScheduler.get_request(request_id: str) -> Optional[MLLMRequest] |
Get a request by ID. | #L815-L817 |
MLLMScheduler.remove_finished_request |
method | MLLMScheduler.remove_finished_request(request_id: str) -> Optional[MLLMRequest] |
Remove a finished request from tracking. | #L819-L821 |
MLLMScheduler.start |
method | async MLLMScheduler.start() -> None |
Start the async scheduler processing loop. | #L825-L834 |
MLLMScheduler.stop |
method | async MLLMScheduler.stop() -> None |
Stop the scheduler. | #L836-L850 |
MLLMScheduler._process_loop |
method | async MLLMScheduler._process_loop() -> None |
Main async processing loop. | #L852-L947 |
MLLMScheduler._process_loop._ensure_streams_bound |
nested function | MLLMScheduler._process_loop._ensure_streams_bound() -> None |
Nested Function MLLMScheduler._process_loop._ensure_streams_bound calls bind_generation_streams. |
#L867-L871 |
MLLMScheduler.add_request_async |
method | async MLLMScheduler.add_request_async(prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, max_tokens: int = 256, temperature: float = 0.7, top_p: float = 0.9, **kwargs) -> str |
Add a multimodal request (async version with output queue). | #L949-L990 |
MLLMScheduler.stream_outputs |
method | async MLLMScheduler.stream_outputs(request_id: str) -> AsyncIterator[RequestOutput] |
Stream outputs for a request. | #L992-L1027 |
MLLMScheduler.generate |
method | async MLLMScheduler.generate(prompt: str, images: Optional[List[str]] = None, videos: Optional[List[str]] = None, audio: Optional[List[str]] = None, **kwargs) -> RequestOutput |
Generate complete output for a request (non-streaming). | #L1029-L1078 |
MLLMScheduler.get_running_requests_info |
method | MLLMScheduler.get_running_requests_info() -> List[Dict[str, Any]] |
Per-request details for status endpoint. | #L1082-L1151 |
MLLMScheduler.get_stats |
method | MLLMScheduler.get_stats() -> Dict[str, Any] |
Get scheduler statistics. | #L1153-L1204 |
MLLMScheduler.clear_runtime_caches |
method | MLLMScheduler.clear_runtime_caches() -> Dict[str, bool] |
Clear runtime caches without resetting scheduler/request state. | #L1206-L1221 |
MLLMScheduler.reset |
method | MLLMScheduler.reset() -> None |
Reset the scheduler state. | #L1223-L1242 |