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

Warn when Config's pipeline_batch_size < model_max_batch_size #1858

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
convert to using logging.warning
  • Loading branch information
cwharris committed Aug 23, 2024
commit cb13abb16c4a086f3c150a2ff75d680f35017b67
2 changes: 1 addition & 1 deletion python/morpheus/morpheus/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def model_max_batch_size(self, value: int):

def _validate_config(self):
if self._pipeline_batch_size < self._model_max_batch_size:
warnings.warn(
logging.warning(
"Config has `pipeline_batch_size < model_max_batch_size` which effectively limits `model_max_batch_size`. This may reduce performance."
)

Expand Down
15 changes: 11 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import json
import os
from unittest import mock
import logging

import pytest

Expand Down Expand Up @@ -108,15 +109,21 @@ def test_to_string(config):
assert isinstance(json.loads(conf_str), dict)


def test_warning_model_batch_size_less_than_pipeline_batch_size():
def test_warning_model_batch_size_less_than_pipeline_batch_size(caplog: pytest.LogCaptureFixture):
config = morpheus.config.Config()
config.pipeline_batch_size = 256
with pytest.warns():
with caplog.at_level(logging.WARNING):
config.model_max_batch_size = 257
assert len(caplog.records) == 1
import re
assert re.match(".*pipeline_batch_size < model_max_batch_size.*", caplog.records[0].message) is not None


def test_warning_pipeline_batch_size_less_than_model_batch_size():
def test_warning_pipeline_batch_size_less_than_model_batch_size(caplog: pytest.LogCaptureFixture):
config = morpheus.config.Config()
config.model_max_batch_size = 8
with pytest.warns():
with caplog.at_level(logging.WARNING):
config.pipeline_batch_size = 7
assert len(caplog.records) == 1
import re
assert re.match(".*pipeline_batch_size < model_max_batch_size.*", caplog.records[0].message) is not None
Loading