2025-10-22 15:16:25 +08:00
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
from vllm.inputs.data import TokensPrompt as _OriginalTokensPrompt
|
2025-11-18 20:54:26 +08:00
|
|
|
from vllm.model_executor.layers.rotary_embedding import MRotaryEmbedding as _OriginalMRotaryEmbedding
|
2025-10-22 15:16:25 +08:00
|
|
|
from vllm.v1.engine import EngineCoreRequest as _OriginalEngineCoreRequest
|
2025-10-24 16:49:19 +08:00
|
|
|
from vllm.v1.request import Request as _OriginalRequest
|
2025-11-18 20:54:26 +08:00
|
|
|
|
2025-10-24 16:49:19 +08:00
|
|
|
from vllm_omni.engine import OmniEngineCoreRequest
|
2025-10-22 15:16:25 +08:00
|
|
|
from vllm_omni.inputs.data import OmniTokensPrompt
|
|
|
|
|
from vllm_omni.model_executor.layers.mrope import MRotaryEmbedding
|
|
|
|
|
from vllm_omni.request import OmniRequest
|
|
|
|
|
|
|
|
|
|
for module_name, module in sys.modules.items():
|
2025-10-24 16:49:19 +08:00
|
|
|
if hasattr(module, "TokensPrompt") and module.TokensPrompt == _OriginalTokensPrompt:
|
2025-10-22 15:16:25 +08:00
|
|
|
module.TokensPrompt = OmniTokensPrompt
|
2025-11-18 20:54:26 +08:00
|
|
|
if hasattr(module, "MRotaryEmbedding") and module.MRotaryEmbedding == _OriginalMRotaryEmbedding:
|
2025-10-22 15:16:25 +08:00
|
|
|
module.MRotaryEmbedding = MRotaryEmbedding
|
2025-10-24 16:49:19 +08:00
|
|
|
if hasattr(module, "Request") and module.Request == _OriginalRequest:
|
2025-10-22 15:16:25 +08:00
|
|
|
module.Request = OmniRequest
|
2025-11-18 20:54:26 +08:00
|
|
|
if hasattr(module, "EngineCoreRequest") and module.EngineCoreRequest == _OriginalEngineCoreRequest:
|
2025-10-24 16:49:19 +08:00
|
|
|
module.EngineCoreRequest = OmniEngineCoreRequest
|