TensorRT-LLMs/tensorrt_llm/_torch/speculative/drafter.py
Ziyi Xiong 58d22a72f1
[TRTLLM-6352][feat] Migrate EAGLE3 and draft/target speculation to Drafter (#6007)
Signed-off-by: ziyixiong-nv <fxiong@nvidia.com>
2025-07-17 21:15:01 +08:00

24 lines
669 B
Python

from abc import ABC, abstractmethod
from typing import Optional
from ..pyexecutor.resource_manager import ResourceManager
from ..pyexecutor.scheduler import ScheduledRequests
class Drafter(ABC):
"""Abstract base class for all drafter implementations."""
@abstractmethod
def prepare_draft_tokens(
self,
scheduled_requests: ScheduledRequests,
resource_manager: Optional[ResourceManager] = None,
) -> None:
"""
Prepare the drafter tokens for the forward computation this step.
Args:
scheduled_requests: The scheduled requests for this iteration
"""
raise NotImplementedError