deepsparse
deepsparse copied to clipboard
Pipeline can dynamic import task from arbitrary python file
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.yamlwhere 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