Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dbogunowicz committed Feb 26, 2024
1 parent 97401ef commit 021fb13
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/deepsparse/evaluation/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ def evaluate(

# if target is a string, turn it into an appropriate pipeline
# otherwise assume it is a pipeline
pipeline = (
create_pipeline(model, engine_type) if isinstance(model, (Path, str)) else model
)
if isinstance(model, (Path, str)):
pipeline, kwargs = create_pipeline(model, engine_type, **kwargs)
else:
pipeline = model

eval_integration = EvaluationRegistry.resolve(pipeline, datasets, integration)

Expand Down
16 changes: 9 additions & 7 deletions src/deepsparse/evaluation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,13 @@ def create_pipeline(
:return: The initialized pipeline
"""
engine_type = engine_type or DEEPSPARSE_ENGINE
return Pipeline.create(
task=kwargs.pop("task", "text-generation"),
model_path=model_path,
sequence_length=kwargs.pop("sequence_length", 2048),
engine_type=engine_type,
batch_size=kwargs.pop("batch_size", 1),
**kwargs,
return (
Pipeline.create(
task=kwargs.pop("task", "text-generation"),
model_path=model_path,
sequence_length=kwargs.pop("sequence_length", 2048),
engine_type=engine_type,
batch_size=kwargs.pop("batch_size", 1),
),
kwargs,
)

0 comments on commit 021fb13

Please sign in to comment.