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

log warning for batch_size 1 #1503

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
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
9 changes: 8 additions & 1 deletion src/deepsparse/legacy/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Classes and registry for end to end inference pipelines that wrap an underlying
inference engine and include pre/postprocessing
"""
import logging
import os
from abc import ABC, abstractmethod
from concurrent.futures import ThreadPoolExecutor
Expand Down Expand Up @@ -75,6 +76,8 @@

SUPPORTED_PIPELINE_ENGINES = [DEEPSPARSE_ENGINE, ORT_ENGINE]

_LOGGER = logging.getLogger(__name__)


class Pipeline(BasePipeline):
"""
Expand Down Expand Up @@ -192,10 +195,14 @@ def __init__(
)

self._engine_args = dict(
batch_size=self._batch_size or 1, # bs=1 for dynamic batch
batch_size=self._batch_size,
num_cores=num_cores,
input_shapes=input_shapes,
)
if self._engine_args["batch_size"] == 0:
_LOGGER.warning("Overriding batch_size from 0 to 1 for dynamic batch")
self._engine_args["batch_size"] = 1

if engine_type.lower() == DEEPSPARSE_ENGINE:
self._engine_args["scheduler"] = scheduler
self._engine_args["num_streams"] = num_streams
Expand Down
Loading