Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
yczhang-nv committed Apr 4, 2024
1 parent da53ac9 commit 1b08bd3
Show file tree
Hide file tree
Showing 20 changed files with 54 additions and 56 deletions.
4 changes: 2 additions & 2 deletions morpheus/_lib/include/morpheus/messages/control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ struct ControlMessageProxy
static pybind11::object get_meta(ControlMessage& self, pybind11::none none_obj);

/**
* TODO(Documentation)
*/
* TODO(Documentation)
*/
static void set_meta(ControlMessage& self, pybind11::object columns, pybind11::object value);
};

Expand Down
9 changes: 6 additions & 3 deletions morpheus/_lib/src/messages/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,11 @@ pybind11::object ControlMessageProxy::get_meta(ControlMessage& self, pybind11::n
return ControlMessageProxy::get_meta(self);
}

std::tuple<py::object, py::object> get_indexers(ControlMessage& self, py::object df, py::object columns, cudf::size_type num_rows)
{
std::tuple<py::object, py::object> get_indexers(ControlMessage& self,
py::object df,
py::object columns,
cudf::size_type num_rows)
{
auto row_indexer = pybind11::slice(pybind11::int_(0), pybind11::int_(num_rows), pybind11::none());

if (columns.is_none())
Expand Down Expand Up @@ -553,7 +556,7 @@ void ControlMessageProxy::set_meta(ControlMessage& self, pybind11::object column
pybind11::gil_scoped_release no_gil;

auto mutable_info = self.payload()->get_mutable_info();
auto num_rows = mutable_info.num_rows();
auto num_rows = mutable_info.num_rows();

// Need the GIL for the remainder
pybind11::gil_scoped_acquire gil;
Expand Down
26 changes: 12 additions & 14 deletions morpheus/_lib/src/stages/add_classification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,22 @@ template class AddClassificationsStage<MultiResponseMessage, MultiResponseMessag
template class AddClassificationsStage<ControlMessage, ControlMessage>;

// ************ AddClassificationStageInterfaceProxy ************* //
std::shared_ptr<mrc::segment::Object<AddClassificationsStageMM>>
AddClassificationStageInterfaceProxy::init_multi(mrc::segment::Builder& builder,
const std::string& name,
std::map<std::size_t, std::string> idx2label,
float threshold)
std::shared_ptr<mrc::segment::Object<AddClassificationsStageMM>> AddClassificationStageInterfaceProxy::init_multi(
mrc::segment::Builder& builder,
const std::string& name,
std::map<std::size_t, std::string> idx2label,
float threshold)
{
return builder.construct_object<AddClassificationsStageMM>(
name, idx2label, threshold);
return builder.construct_object<AddClassificationsStageMM>(name, idx2label, threshold);
}

std::shared_ptr<mrc::segment::Object<AddClassificationsStageCC>>
AddClassificationStageInterfaceProxy::init_cm(mrc::segment::Builder& builder,
const std::string& name,
std::map<std::size_t, std::string> idx2label,
float threshold)
std::shared_ptr<mrc::segment::Object<AddClassificationsStageCC>> AddClassificationStageInterfaceProxy::init_cm(
mrc::segment::Builder& builder,
const std::string& name,
std::map<std::size_t, std::string> idx2label,
float threshold)
{
return builder.construct_object<AddClassificationsStageCC>(
name, idx2label, threshold);
return builder.construct_object<AddClassificationsStageCC>(name, idx2label, threshold);
}

} // namespace morpheus
15 changes: 5 additions & 10 deletions morpheus/_lib/src/stages/add_scores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,14 @@ template class AddScoresStage<MultiResponseMessage, MultiResponseMessage>;
template class AddScoresStage<ControlMessage, ControlMessage>;

// ************ AddScoresStageInterfaceProxy ************* //
std::shared_ptr<mrc::segment::Object<AddScoresStageMM>>
AddScoresStageInterfaceProxy::init_multi(mrc::segment::Builder& builder,
const std::string& name,
std::map<std::size_t, std::string> idx2label)
std::shared_ptr<mrc::segment::Object<AddScoresStageMM>> AddScoresStageInterfaceProxy::init_multi(
mrc::segment::Builder& builder, const std::string& name, std::map<std::size_t, std::string> idx2label)
{
return builder.construct_object<AddScoresStageMM>(name,
std::move(idx2label));
return builder.construct_object<AddScoresStageMM>(name, std::move(idx2label));
}

std::shared_ptr<mrc::segment::Object<AddScoresStageCC>>
AddScoresStageInterfaceProxy::init_cm(mrc::segment::Builder& builder,
const std::string& name,
std::map<std::size_t, std::string> idx2label)
std::shared_ptr<mrc::segment::Object<AddScoresStageCC>> AddScoresStageInterfaceProxy::init_cm(
mrc::segment::Builder& builder, const std::string& name, std::map<std::size_t, std::string> idx2label)
{
return builder.construct_object<AddScoresStageCC>(name, std::move(idx2label));
}
Expand Down
7 changes: 3 additions & 4 deletions morpheus/_lib/stages/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ PYBIND11_MODULE(stages, _module)

mrc::pymrc::from_import(_module, "morpheus._lib.common", "FilterSource");

py::class_<
mrc::segment::Object<AddClassificationsStageMM>,
mrc::segment::ObjectProperties,
std::shared_ptr<mrc::segment::Object<AddClassificationsStageMM>>>(
py::class_<mrc::segment::Object<AddClassificationsStageMM>,
mrc::segment::ObjectProperties,
std::shared_ptr<mrc::segment::Object<AddClassificationsStageMM>>>(
_module, "AddClassificationsMultiResponseMessageStage", py::multiple_inheritance())
.def(py::init<>(&AddClassificationStageInterfaceProxy::init_multi),
py::arg("builder"),
Expand Down
4 changes: 2 additions & 2 deletions morpheus/_lib/tests/stages/test_preprocess_fil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ TEST_F(TestPreprocessFIL, TestProcessControlMessageAndMultiMessage)
EXPECT_EQ(cm_input__0_host, mm_input__0_host);

std::vector<TensorIndex> expected_seq_ids = {0, 0, 1, 1, 0, 1, 2, 0, 1};
auto cm_seq_ids = cm_tensors->get_tensor("seq_ids");
auto mm_seq_ids = mm_tensors->get_tensor("seq_ids");
auto cm_seq_ids = cm_tensors->get_tensor("seq_ids");
auto mm_seq_ids = mm_tensors->get_tensor("seq_ids");
std::vector<TensorIndex> cm_seq_ids_host(cm_seq_ids.count());
std::vector<TensorIndex> mm_seq_ids_host(mm_seq_ids.count());
MRC_CHECK_CUDA(cudaMemcpy(
Expand Down
3 changes: 2 additions & 1 deletion morpheus/controllers/serialize_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
import re
import typing

from morpheus.messages import ControlMessage
from morpheus.messages import MessageMeta
from morpheus.messages import MultiMessage, ControlMessage
from morpheus.messages import MultiMessage


class SerializeController:
Expand Down
1 change: 0 additions & 1 deletion morpheus/stages/postprocess/add_classifications_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from morpheus.messages import ControlMessage
from morpheus.stages.postprocess.add_scores_stage_base import AddScoresStageBase


logger = logging.getLogger(__name__)


Expand Down
2 changes: 1 addition & 1 deletion morpheus/stages/postprocess/add_scores_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import mrc

from morpheus.messages import ControlMessage
from morpheus.cli.register_stage import register_stage
from morpheus.common import TypeId
from morpheus.config import Config
from morpheus.messages import ControlMessage
from morpheus.stages.postprocess.add_scores_stage_base import AddScoresStageBase

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion morpheus/stages/postprocess/add_scores_stage_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import mrc
import mrc.core.operators as ops

from morpheus.messages import ControlMessage
from morpheus.common import TypeId
from morpheus.config import Config
from morpheus.messages import ControlMessage
from morpheus.messages import MultiResponseMessage
from morpheus.pipeline.pass_thru_type_mixin import PassThruTypeMixin
from morpheus.pipeline.single_port_stage import SinglePortStage
Expand Down
3 changes: 2 additions & 1 deletion morpheus/stages/postprocess/serialize_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
from morpheus.cli.register_stage import register_stage
from morpheus.config import Config
from morpheus.controllers.serialize_controller import SerializeController
from morpheus.messages import ControlMessage
from morpheus.messages import MessageMeta
from morpheus.messages import MultiMessage, ControlMessage
from morpheus.messages import MultiMessage
from morpheus.pipeline.single_port_stage import SinglePortStage
from morpheus.pipeline.stage_schema import StageSchema

Expand Down
4 changes: 2 additions & 2 deletions morpheus/stages/preprocess/preprocess_fil_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
import cudf

import morpheus._lib.stages as _stages
from morpheus.messages import ControlMessage
from morpheus.messages import TensorMemory as CppTensorMemory
from morpheus.cli.register_stage import register_stage
from morpheus.config import Config
from morpheus.config import PipelineModes
from morpheus.messages import ControlMessage
from morpheus.messages import InferenceMemoryFIL
from morpheus.messages import MultiInferenceFILMessage
from morpheus.messages import MultiInferenceMessage
from morpheus.messages import MultiMessage
from morpheus.messages import TensorMemory as CppTensorMemory
from morpheus.stages.preprocess.preprocess_base_stage import PreprocessBaseStage

logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions morpheus/stages/preprocess/preprocess_nlp_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
import cudf

import morpheus._lib.stages as _stages
# pylint: disable=morpheus-incorrect-lib-from-import
from morpheus.messages import TensorMemory as CppTensorMemory
from morpheus.cli.register_stage import register_stage
from morpheus.cli.utils import MorpheusRelativePath
from morpheus.cli.utils import get_package_relative_file
from morpheus.config import Config
from morpheus.config import PipelineModes
# pylint: disable=morpheus-incorrect-lib-from-import
from morpheus.messages import ControlMessage
from morpheus.messages import InferenceMemoryNLP
from morpheus.messages import MultiInferenceMessage
from morpheus.messages import MultiInferenceNLPMessage
from morpheus.messages import MultiMessage
from morpheus.messages import TensorMemory as CppTensorMemory
from morpheus.stages.preprocess.preprocess_base_stage import PreprocessBaseStage
from morpheus.utils.cudf_subword_helper import tokenize_text_series

Expand Down
5 changes: 3 additions & 2 deletions tests/_utils/stages/conv_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@

import cudf

from morpheus._lib.messages import TensorMemory as CppTensorMemory
from morpheus.cli.register_stage import register_stage
from morpheus.config import Config
from morpheus._lib.messages import TensorMemory as CppTensorMemory
from morpheus.messages import ControlMessage
from morpheus.messages import MultiMessage
from morpheus.messages import ControlMessage, MultiResponseMessage
from morpheus.messages import MultiResponseMessage
from morpheus.messages import ResponseMemory
from morpheus.pipeline.single_port_stage import SinglePortStage
from morpheus.pipeline.stage_schema import StageSchema
Expand Down
4 changes: 2 additions & 2 deletions tests/stages/test_preprocess_fil_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import cudf

from morpheus.messages import ControlMessage
from morpheus.messages import MultiMessage
from morpheus.config import Config
from morpheus.config import ConfigFIL
from morpheus.messages import ControlMessage
from morpheus.messages import MessageMeta
from morpheus.messages import MultiMessage
from morpheus.stages.preprocess.preprocess_fil_stage import PreprocessFILStage


Expand Down
4 changes: 2 additions & 2 deletions tests/stages/test_preprocess_nlp_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

import cudf

from morpheus.messages import ControlMessage
from morpheus.messages import MultiMessage
from morpheus.config import Config
from morpheus.messages import ControlMessage
from morpheus.messages import MessageMeta
from morpheus.messages import MultiMessage
from morpheus.stages.preprocess.preprocess_nlp_stage import PreprocessNLPStage


Expand Down
4 changes: 2 additions & 2 deletions tests/test_add_classifications_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import cudf

from _utils.dataset_manager import DatasetManager
from morpheus.messages import ControlMessage
from morpheus.config import Config
from morpheus._lib.messages import TensorMemory as CppTensorMemory
from morpheus.config import Config
from morpheus.messages import ControlMessage
from morpheus.messages.memory.tensor_memory import TensorMemory
from morpheus.messages.message_meta import MessageMeta
from morpheus.messages.multi_response_message import MultiResponseMessage
Expand Down
2 changes: 1 addition & 1 deletion tests/test_add_classifications_stage_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

from _utils import assert_results
from _utils.stages.conv_msg import ConvMsg
from morpheus.messages import ControlMessage
from morpheus.config import CppConfig
from morpheus.messages import ControlMessage
from morpheus.messages import MessageMeta
from morpheus.messages import MultiMessage
from morpheus.messages import MultiResponseMessage
Expand Down
4 changes: 2 additions & 2 deletions tests/test_add_scores_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import cudf

from _utils.dataset_manager import DatasetManager
from morpheus.messages import ControlMessage
from morpheus.config import Config
from morpheus._lib.messages import TensorMemory as CppTensorMemory
from morpheus.config import Config
from morpheus.messages import ControlMessage
from morpheus.messages.memory.tensor_memory import TensorMemory
from morpheus.messages.message_meta import MessageMeta
from morpheus.messages.multi_response_message import MultiResponseMessage
Expand Down
3 changes: 2 additions & 1 deletion tests/test_add_scores_stage_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from _utils import assert_results
from _utils.dataset_manager import DatasetManager
from _utils.stages.conv_msg import ConvMsg
from morpheus.config import Config, CppConfig
from morpheus.config import Config
from morpheus.config import CppConfig
from morpheus.messages import ControlMessage
from morpheus.messages import MessageMeta
from morpheus.messages import MultiMessage
Expand Down

0 comments on commit 1b08bd3

Please sign in to comment.