deepsparse icon indicating copy to clipboard operation
deepsparse copied to clipboard

Pipeline can dynamic import task from arbitrary python file

Open corey-nm opened this issue 3 years ago • 0 comments

Tested with:

  • The new unit tests added to PR
  • running deepsparse.server --task import:my_pipeline --model_path ... where my_pipeline.py had this contents
from deepsparse.pipeline import Pipeline
from deepsparse.transformers.pipelines.question_answering import (
    QuestionAnsweringPipeline,
)

TASK = "my_qa_task"
Pipeline.register(TASK)(QuestionAnsweringPipeline)
  • running deepsparse.server --task import:deepsparse.my_pipeline --model_path ... from a different directory
  • running deepsparse.server --config_file config.yaml where config.yaml had this contents:
models:
    - task: "import:my_pipeline"
      model_path: zoo:nlp/question_answering/bert-base/pytorch/huggingface/squad/base-none
      batch_size: 1
      alias: question_answering/base

corey-nm avatar Aug 10 '22 19:08 corey-nm