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

Add Engine.generate_random_inputs() #966

Merged
merged 1 commit into from
Mar 21, 2023
Merged

Add Engine.generate_random_inputs() #966

merged 1 commit into from
Mar 21, 2023

Conversation

mgoin
Copy link
Member

@mgoin mgoin commented Mar 21, 2023

An ease of use improvement to simplify demo code and reduce chance for errors.

Now we can do

from deepsparse import Engine

bert_engine = Engine(model="zoo:nlp/text_classification/obert-base/pytorch/huggingface/mnli/pruned90_quant-none")

inputs = bert_engine.generate_random_inputs()
output = bert_engine(inputs)

instead of

from deepsparse import Engine
from deepsparse.utils import generate_random_inputs, model_to_path

sparsezoo_stub = "zoo:nlp/text_classification/obert-base/pytorch/huggingface/mnli/pruned90_quant-none"
bert_engine = Engine(model=sparsezoo_stub)

inputs = generate_random_inputs(model_to_path(sparsezoo_stub), batch_size)
output = bert_engine(inputs)

@mgoin mgoin requested review from a team, markurtz, DaltheCow and KSGulin and removed request for a team March 21, 2023 14:34
@mgoin mgoin merged commit a8079c0 into main Mar 21, 2023
@mgoin mgoin deleted the engine-random-inputs branch March 21, 2023 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants