@@ -411,71 +411,6 @@ class TextLLMRunner:
411411
412412 def __repr__ (self ) -> str : ...
413413
414- class LLMSession :
415- """A per-conversation session created by LLMEngine: reuses the engine's
416- program/resources (weight sharing is backend-dependent — see
417- LLMEngine.serving_capacity()) but owns its own KV cache. Backend calls
418- (prefill_tokens/decode_one) are serialized across the engine's sessions by
419- an engine-owned lock."""
420-
421- def prefill_tokens (self , token_ids : List [int ], temperature : float = - 1.0 ) -> None :
422- """Prefill pre-tokenized input. `temperature` is the first-token sampling
423- for backends that sample during prefill (ignored by decode-time
424- samplers)."""
425- ...
426-
427- def decode_one (self , temperature : float = - 1.0 ) -> dict :
428- """One decode step -> {"token_id": int, "text": bytes, "is_eos": bool}."""
429- ...
430-
431- def seek (self , pos : int ) -> None : ...
432- def position (self ) -> int : ...
433- def reset (self ) -> None : ...
434- def stop (self ) -> None :
435- """Token-boundary cooperative stop: safe from another thread, but it
436- does not abort a decode_one() already running — it takes effect before
437- the next decode_one()."""
438- ...
439-
440- def __repr__ (self ) -> str : ...
441-
442- class LLMEngine :
443- """Engine for multi-session text generation over one loaded program.
444-
445- Loads the model's program once; create_session() returns a LLMSession that
446- reuses it but owns its own KV cache. Whether extra sessions avoid
447- duplicating packed weights is backend-dependent — ask serving_capacity(). Backend execution across all sessions of one engine is
448- serialized by an engine-owned lock (backend ops are not assumed
449- thread-safe), so it is safe to drive multiple sessions from multiple Python
450- threads.
451- """
452-
453- def __init__ (
454- self ,
455- model_path : str ,
456- tokenizer_path : str ,
457- data_path : Optional [str ] = None ,
458- method_name : str = "forward" ,
459- temperature : float = - 1.0 ,
460- ) -> None : ...
461- def create_session (self ) -> LLMSession :
462- """Create a session that reuses this engine's program/resources (weight
463- sharing is backend-dependent — see serving_capacity()), with its own KV
464- cache."""
465- ...
466-
467- def serving_capacity (self ) -> dict :
468- """Serving-capacity dict: max_physical_sessions_without_weight_duplication
469- (1 = single-slot, no weight duplication) and estimated_bytes_per_session
470- (0 = unknown). The server clamps physical sessions to this."""
471- ...
472-
473- def metadata (self ) -> dict :
474- """Model metadata from the .pte, e.g. get_max_context_len."""
475- ...
476-
477- def __repr__ (self ) -> str : ...
478-
479414class MultimodalRunner :
480415 """Runner for multimodal language models."""
481416
0 commit comments