Skip to content

Commit

Permalink
Revert "Mark the LLMEngineStage as supporting CPU & GPU execution modes"
Browse files Browse the repository at this point in the history
This reverts commit f70787b.
  • Loading branch information
dagardner-nv committed Sep 19, 2024
1 parent 5bcd44d commit cf17c9f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions python/morpheus_llm/morpheus_llm/stages/llm/llm_engine_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
import functools
import logging
import types
import typing

import mrc
from mrc.core import operators as ops

from morpheus.config import Config
from morpheus.config import ExecutionMode
from morpheus.config import CppConfig
from morpheus.messages import ControlMessage
from morpheus.pipeline.execution_mode_mixins import GpuAndCpuMixin
from morpheus.pipeline.pass_thru_type_mixin import PassThruTypeMixin
from morpheus.pipeline.single_port_stage import SinglePortStage
from morpheus_llm.llm import LLMEngine

logger = logging.getLogger(__name__)


class LLMEngineStage(PassThruTypeMixin, GpuAndCpuMixin, SinglePortStage):
class LLMEngineStage(PassThruTypeMixin, SinglePortStage):
"""
Stage for executing an LLM engine within a Morpheus pipeline.
Expand All @@ -52,7 +52,7 @@ def name(self) -> str:
"""Return the name of the stage"""
return "llm-engine"

def accepted_types(self) -> tuple:
def accepted_types(self) -> typing.Tuple:
"""
Returns accepted input types for this stage.
Expand All @@ -70,8 +70,8 @@ def supports_cpp_node(self):

def _cast_control_message(self, message: ControlMessage, *, cpp_messages_lib: types.ModuleType) -> ControlMessage:
"""
LLMEngineStage does not contain a Python implementation, however it is capable of running in cpu-only mode.
This method is needed to cast the Python ControlMessage to a C++ ControlMessage.
LLMEngineStage does not contain a Python implementation, however it is capable of running in Python/cpu-only
mode. This method is needed to cast the Python ControlMessage to a C++ ControlMessage.
This is different than casting from the Python bindings for the C++ ControlMessage to a C++ ControlMessage.
"""
Expand All @@ -82,7 +82,7 @@ def _build_single(self, builder: mrc.Builder, input_node: mrc.SegmentObject) ->
node = _llm.LLMEngineStage(builder, self.unique_name, self._engine)
node.launch_options.pe_count = 1

if self._config.execution_mode == ExecutionMode.CPU:
if not CppConfig.get_should_use_cpp():
import morpheus._lib.messages as _messages
cast_fn = functools.partial(self._cast_control_message, cpp_messages_lib=_messages)
pre_node = builder.make_node(f"{self.unique_name}-pre-cast", ops.map(cast_fn))
Expand Down

0 comments on commit cf17c9f

Please sign in to comment.