Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing support for MultiMessage from stages #1803

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
ba506fa
Remove MultiMessage from AddScoresStage
yczhang-nv Jul 8, 2024
bb18d7e
Remove MultiMessage from AddScoresStage python impl & reformatting
yczhang-nv Jul 8, 2024
6500db8
fix test errors
yczhang-nv Jul 9, 2024
6402965
remove from preprocess_nlp cpp impl
yczhang-nv Jul 9, 2024
7a53076
remove from preprocess_nlp python impl
yczhang-nv Jul 9, 2024
f4f97bd
remove from preprocess_fil cpp impl
yczhang-nv Jul 9, 2024
9e8b2c5
remove from preprocess_fil python impl
yczhang-nv Jul 9, 2024
0bbadbc
remove from preprocess_ae impl
yczhang-nv Jul 9, 2024
a960468
remove from serialize stage impl
yczhang-nv Jul 9, 2024
5c45b62
remove from filter_detections impl
yczhang-nv Jul 9, 2024
6ea61b8
remove from filter_detections_controller
yczhang-nv Jul 10, 2024
81ccd6e
remove from generate_viz_frames
yczhang-nv Jul 10, 2024
fecd7e0
remove from mlflow_drift_stage
yczhang-nv Jul 10, 2024
4a572c9
remove from timeseries stage
yczhang-nv Jul 10, 2024
3e3ad14
remove from validation stage
yczhang-nv Jul 10, 2024
fa3d971
update deserialize stage
yczhang-nv Jul 10, 2024
30a76a2
fix some unit tests
yczhang-nv Jul 11, 2024
6629139
fix unit tests
yczhang-nv Jul 12, 2024
746530c
fix inference
yczhang-nv Jul 12, 2024
f0dbfc0
update fil stage
yczhang-nv Jul 15, 2024
46217dc
rollback to test triton_inference_stage
yczhang-nv Jul 15, 2024
72171fa
test cm for test_inference_stage
yczhang-nv Jul 15, 2024
3753707
passed test_triton_inference_stage
yczhang-nv Jul 17, 2024
b6509f0
fix
yczhang-nv Jul 17, 2024
bddaf5f
debugging test_dfp.py
yczhang-nv Jul 19, 2024
cc945c7
fix test_dfp.py
yczhang-nv Jul 22, 2024
b436176
fix test_phishing.py
yczhang-nv Jul 22, 2024
83e8367
Merge remote-tracking branch 'upstream/branch-24.10' into verify-and-…
yczhang-nv Jul 22, 2024
9ca9320
fix test
yczhang-nv Jul 22, 2024
55c75a6
remove some multimessage branches
yczhang-nv Jul 23, 2024
90ab421
fix ci
yczhang-nv Jul 23, 2024
94e4639
fix ci
yczhang-nv Jul 24, 2024
aa00fbb
fix naming
yczhang-nv Jul 25, 2024
e77a50a
fix ci
yczhang-nv Jul 25, 2024
d8b60d6
Merge branch 'branch-24.10' into complete-remove-multi-message
yczhang-nv Jul 25, 2024
4581346
fix CI
yczhang-nv Jul 26, 2024
8cd1a7d
fix CI
yczhang-nv Jul 26, 2024
66013af
fix CI
yczhang-nv Jul 26, 2024
554856c
test gpg
yczhang-nv Jul 29, 2024
dfff798
test gpg sign
yczhang-nv Jul 29, 2024
5940311
test gpg
yczhang-nv Jul 29, 2024
5b890d2
test gpg
yczhang-nv Jul 29, 2024
9977a6a
gix abp_pcap_detection
yczhang-nv Jul 29, 2024
9351310
Finalize CI
yczhang-nv Jul 29, 2024
10a01ff
rollback
yczhang-nv Jul 29, 2024
db17566
Merge remote-tracking branch 'upstream/branch-24.10' into complete-re…
yczhang-nv Aug 13, 2024
8d9ecf4
fix python checks
yczhang-nv Aug 13, 2024
fa816ff
fix typo
yczhang-nv Aug 13, 2024
5927b62
Merge remote-tracking branch 'upstream/branch-24.10' into complete-re…
yczhang-nv Aug 14, 2024
95725c8
fix ci
yczhang-nv Aug 14, 2024
c4b1cdf
Merge branch 'branch-24.10' into complete-remove-multi-message
yczhang-nv Aug 14, 2024
c596520
Merge branch 'branch-24.10' into complete-remove-multi-message
yczhang-nv Aug 15, 2024
24c3af0
Merge remote-tracking branch 'upstream/branch-24.10' into complete-re…
yczhang-nv Aug 27, 2024
d3e1b45
support casting TensorObject from Python to C++ for ControlMessage
yczhang-nv Aug 28, 2024
371f001
add overload to TensorObject
yczhang-nv Aug 28, 2024
ac94065
Update comment
yczhang-nv Aug 28, 2024
efd9937
Update comments
yczhang-nv Aug 28, 2024
dd0e0a0
Merge branch 'cast-python-tensor-memory-to-cpp-for-control-message' i…
yczhang-nv Aug 28, 2024
4218d74
fix comments
yczhang-nv Aug 29, 2024
08fb90e
fix comments
yczhang-nv Aug 29, 2024
41e9e2f
fic CI format
yczhang-nv Aug 29, 2024
b811206
fix format
yczhang-nv Aug 29, 2024
c2bf5d3
fix CI
yczhang-nv Aug 29, 2024
8033055
Fix CI
yczhang-nv Aug 29, 2024
f4be468
fix CI
yczhang-nv Aug 29, 2024
809bbb5
revert changes that break the build
yczhang-nv Aug 29, 2024
9c03ee9
fix CI
yczhang-nv Aug 29, 2024
66922a7
fix CI
yczhang-nv Aug 29, 2024
f5c16b0
Merge remote-tracking branch 'upstream/branch-24.10' into cast-python…
yczhang-nv Sep 6, 2024
dddd3c8
fix CI
yczhang-nv Sep 6, 2024
c4a7095
Merge remote-tracking branch 'upstream/branch-24.10' into complete-re…
yczhang-nv Sep 6, 2024
9f30383
revert format
yczhang-nv Sep 6, 2024
38e8f9c
Merge remote-tracking branch 'origin/cast-python-tensor-memory-to-cpp…
yczhang-nv Sep 6, 2024
32ec933
fix CI
yczhang-nv Sep 6, 2024
f43f10a
try to minimize CI errors
yczhang-nv Sep 6, 2024
c74f51f
Update ransomware pipeline to use ControlMessage
yczhang-nv Sep 6, 2024
0876026
Merge branch 'branch-24.10' into complete-remove-multi-message
yczhang-nv Sep 6, 2024
9ed5e32
Merge branch 'complete-remove-multi-message' of github.com:yczhang-nv…
yczhang-nv Sep 6, 2024
ae33cab
remove comments
yczhang-nv Sep 6, 2024
84d179d
fix CI
yczhang-nv Sep 6, 2024
b33e128
fix format
yczhang-nv Sep 6, 2024
1776efc
Merge branch 'branch-24.10' into complete-remove-multi-message
yczhang-nv Sep 7, 2024
a848845
fix doc
yczhang-nv Sep 9, 2024
4115cc9
fix merge conflict
yczhang-nv Sep 9, 2024
8201199
Revert "Merge remote-tracking branch 'origin/cast-python-tensor-memor…
yczhang-nv Sep 9, 2024
0dc0947
Revert "fic CI format"
yczhang-nv Sep 9, 2024
6656224
Revert "support casting TensorObject from Python to C++ for ControlMe…
yczhang-nv Sep 9, 2024
21e3d2f
fix revert error
yczhang-nv Sep 9, 2024
2023469
fix CI
yczhang-nv Sep 9, 2024
adbc5ca
fix CI
yczhang-nv Sep 9, 2024
6d65a6d
TensorMemory
yczhang-nv Sep 10, 2024
7d8a64b
Cleanup during review
mdemoret-nv Sep 10, 2024
8b0833d
Fixing formatting on pyi files
mdemoret-nv Sep 10, 2024
9a975c1
fix header and formatting issue
yczhang-nv Sep 10, 2024
91474a3
fix docstring
yczhang-nv Sep 10, 2024
ecb6766
fix CI
yczhang-nv Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove from mlflow_drift_stage
  • Loading branch information
yczhang-nv committed Jul 10, 2024
commit fecd7e02a2cf088432d4556da2461b9d7e964e72
17 changes: 5 additions & 12 deletions morpheus/stages/postprocess/ml_flow_drift_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from morpheus.config import Config
from morpheus.config import PipelineModes
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 Expand Up @@ -124,16 +123,13 @@ def accepted_types(self) -> typing.Tuple:
Accepted input types.

"""
return (MultiResponseMessage, ControlMessage)
return (ControlMessage,)

def supports_cpp_node(self):
return False

def _calc_drift(self, x: MultiResponseMessage | ControlMessage):
if isinstance(x, MultiResponseMessage):
probs_tensor = x.get_probs_tensor()
elif isinstance(x, ControlMessage):
probs_tensor = x.tensors().get_tensor("probs")
def _calc_drift(self, msg: ControlMessage):
probs_tensor = msg.tensors().get_tensor("probs")

# All probs in a batch will be calculated
shifted = cp.abs(probs_tensor - 0.5) + 0.5
Expand All @@ -142,10 +138,7 @@ def _calc_drift(self, x: MultiResponseMessage | ControlMessage):
for label in range(len(self._labels), shifted.shape[1]):
self._labels.append(str(label))

if isinstance(x, MultiResponseMessage):
count = x.count
elif isinstance(x, ControlMessage):
count = x.payload().count
count = msg.payload().count

for i in list(range(0, count, self._batch_size)):
start = i
Expand All @@ -159,7 +152,7 @@ def _calc_drift(self, x: MultiResponseMessage | ControlMessage):

mlflow.log_metrics(metrics)

return x
return msg

def _build_single(self, builder: mrc.Builder, input_node: mrc.SegmentObject) -> mrc.SegmentObject:

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

import morpheus._lib.messages as _messages
from morpheus.messages import ControlMessage
from morpheus.messages import MultiResponseMessage
from morpheus.messages import ResponseMemory
from morpheus.messages.message_meta import MessageMeta
from morpheus.stages.postprocess.ml_flow_drift_stage import MLFlowDriftStage


def _make_multi_response_message(df, probs):
df_ = df[0:len(probs)]
mem = ResponseMemory(count=len(df_), tensors={'probs': probs})

return MultiResponseMessage(meta=MessageMeta(df_), count=len(df_), memory=mem)


def _make_control_message(df, probs):
df_ = df[0:len(probs)]
cm = ControlMessage()
Expand All @@ -51,7 +42,6 @@ def test_constructor(config):
assert stage.name == "mlflow_drift"

accepted_union = typing.Union[stage.accepted_types()]
assert typing_utils.issubtype(MultiResponseMessage, accepted_union)
assert typing_utils.issubtype(ControlMessage, accepted_union)


Expand All @@ -63,7 +53,7 @@ def test_calc_drift(config, filter_probs_df):
stage = MLFlowDriftStage(config, labels=labels, batch_size=1)

probs = cp.array([[0.1, 0.5, 0.3], [0.2, 0.3, 0.4]])
mock_multi_response_message = _make_multi_response_message(filter_probs_df, probs)

mock_control_message = _make_control_message(filter_probs_df, probs)

expected_metrics = [{
Expand All @@ -72,16 +62,9 @@ def test_calc_drift(config, filter_probs_df):
'a': 0.8, 'b': 0.7, 'c': 0.6, 'total': 0.7000000000000001
}]

multi_response_message_metrics = []
with patch("morpheus.stages.postprocess.ml_flow_drift_stage.mlflow.log_metrics") as mock_log_metrics:
stage._calc_drift(mock_multi_response_message)
for call_arg in mock_log_metrics.call_args_list:
multi_response_message_metrics.append(call_arg[0][0])
assert multi_response_message_metrics == expected_metrics

control_message_metrics = []
with patch("morpheus.stages.postprocess.ml_flow_drift_stage.mlflow.log_metrics") as mock_log_metrics:
stage._calc_drift(mock_control_message)
for call_arg in mock_log_metrics.call_args_list:
control_message_metrics.append(call_arg[0][0])
assert control_message_metrics == multi_response_message_metrics
assert control_message_metrics == expected_metrics
Loading