Skip to content

Commit

Permalink
update pathways to use new v2 pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
dsikka committed Dec 6, 2023
1 parent 29e1356 commit 5abfc26
Show file tree
Hide file tree
Showing 108 changed files with 2,513 additions and 2,380 deletions.
1 change: 0 additions & 1 deletion src/deepsparse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from .engine import *
from .tasks import *
from .pipeline import *
from .base_pipeline import *
from .loggers import *
from .version import __version__, is_release
from .analytics import deepsparse_analytics as _analytics
Expand Down
2 changes: 1 addition & 1 deletion src/deepsparse/clip/decoder_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import numpy as np
from pydantic import BaseModel, Field

from deepsparse import Pipeline
from deepsparse.legacy import Pipeline
from deepsparse.utils import model_to_path


Expand Down
2 changes: 1 addition & 1 deletion src/deepsparse/clip/text_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import numpy as np
from pydantic import BaseModel, Field

from deepsparse.pipeline import Pipeline
from deepsparse.legacy.pipeline import Pipeline
from deepsparse.utils import model_to_path
from open_clip.tokenizer import tokenize

Expand Down
2 changes: 1 addition & 1 deletion src/deepsparse/clip/visual_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from torchvision.transforms import InterpolationMode

from deepsparse.clip.constants import CLIP_RGB_MEANS, CLIP_RGB_STDS
from deepsparse.pipeline import Pipeline
from deepsparse.legacy.pipeline import Pipeline
from deepsparse.pipelines.computer_vision import ComputerVisionSchema
from deepsparse.utils import model_to_path

Expand Down
2 changes: 1 addition & 1 deletion src/deepsparse/clip/zeroshot_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pydantic import BaseModel, Field

from deepsparse.clip import CLIPTextInput, CLIPVisualInput
from deepsparse.pipeline import BasePipeline, Pipeline
from deepsparse.legacy.pipeline import BasePipeline, Pipeline
from scipy.special import softmax


Expand Down
6 changes: 5 additions & 1 deletion src/deepsparse/evaluation/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@
)
from src.deepsparse.evaluation.results import Result, save_evaluations
from src.deepsparse.evaluation.utils import args_to_dict, get_save_path
from src.deepsparse.pipeline import DEEPSPARSE_ENGINE, ORT_ENGINE, TORCHSCRIPT_ENGINE
from src.deepsparse.operators.engine_operator import (
DEEPSPARSE_ENGINE,
ORT_ENGINE,
TORCHSCRIPT_ENGINE,
)


_LOGGER = logging.getLogger(__name__)
Expand Down
6 changes: 5 additions & 1 deletion src/deepsparse/evaluation/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
)
from src.deepsparse.evaluation.registry import EvaluationRegistry
from src.deepsparse.evaluation.results import Result
from src.deepsparse.pipeline import DEEPSPARSE_ENGINE, ORT_ENGINE, TORCHSCRIPT_ENGINE
from src.deepsparse.operators.engine_operator import (
DEEPSPARSE_ENGINE,
ORT_ENGINE,
TORCHSCRIPT_ENGINE,
)


__all__ = ["evaluate"]
Expand Down
3 changes: 2 additions & 1 deletion src/deepsparse/evaluation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

from transformers import AutoModelForCausalLM

from deepsparse import DEEPSPARSE_ENGINE, ORT_ENGINE, Pipeline
from deepsparse import Pipeline
from deepsparse.operators.engine_operator import DEEPSPARSE_ENGINE, ORT_ENGINE


__all__ = ["text_generation_model_from_target", "get_save_path", "args_to_dict"]
Expand Down
2 changes: 1 addition & 1 deletion src/deepsparse/image_classification/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ImageClassificationInput,
ImageClassificationOutput,
)
from deepsparse.pipeline import Pipeline
from deepsparse.legacy.pipeline import Pipeline
from deepsparse.utils import model_to_path


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,10 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .operators import *
from .base_pipeline import *
from .pipeline import *
from .routers import *
from .schedulers import *
from .task import *
from .utils import *
from .tasks import *
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
from pydantic import BaseModel

from deepsparse import Context
from deepsparse.legacy.tasks import SupportedTasks, dynamic_import_task
from deepsparse.loggers.base_logger import BaseLogger
from deepsparse.loggers.build_logger import logger_from_config
from deepsparse.loggers.constants import validate_identifier
from deepsparse.tasks import SupportedTasks, dynamic_import_task


__all__ = [
Expand Down Expand Up @@ -166,7 +166,7 @@ def create(
implementation
:return: pipeline object initialized for the given task
"""
from deepsparse.pipeline import Bucketable, BucketingPipeline, Pipeline
from deepsparse.legacy.pipeline import Bucketable, BucketingPipeline, Pipeline

pipeline_constructor = BasePipeline._get_task_constructor(task)
model_path = kwargs.get("model_path", None)
Expand Down Expand Up @@ -278,7 +278,7 @@ def from_config(
logging. Default is None
:return: loaded Pipeline object from the config
"""
from deepsparse.pipeline import PipelineConfig
from deepsparse.legacy.pipeline import PipelineConfig

if isinstance(config, Path) or (
isinstance(config, str) and os.path.exists(config)
Expand Down Expand Up @@ -308,7 +308,7 @@ def to_config(self) -> "PipelineConfig": # noqa: F821
"""
:return: PipelineConfig that can be used to reload this object
"""
from deepsparse.pipeline import PipelineConfig
from deepsparse.legacy.pipeline import PipelineConfig

if not hasattr(self, "task"):
raise RuntimeError(
Expand Down
Loading

0 comments on commit 5abfc26

Please sign in to comment.