Skip to content

Commit

Permalink
Merge pull request #171 from furiosamg/minor-modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
furiosamg authored Aug 30, 2023
2 parents 65772bc + fe1e6f3 commit 78ff0a8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/examples/ssd_mobilenet_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
quantized_onnx = quantize(onnx_model, calib_range)

with create_runner(quantized_onnx, compiler_config=compiler_config) as runner:
# Models in the Model Zoo have built-in optimizations that, by default,
# bypass normalization, quantization, and type conversion. If you compile
# and utilize these models without employing these optimizations, it's
# necessary to set up preprocessing steps to incorporate normalization and
# type casting. To accomplish this, you should introduce an extra parameter,
# `with_scaling=True`.
inputs, contexts = mobilenet.preprocess(image, with_scaling=True)
outputs = runner.run(inputs)
mobilenet.postprocess(outputs, contexts[0])
4 changes: 2 additions & 2 deletions furiosa/models/client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from tqdm import tqdm

from furiosa.runtime.sync import create_runner

from .. import vision
from ..types import Model, PythonPostProcessor

Expand Down Expand Up @@ -102,8 +104,6 @@ def decorate_result(


def run_inferences(model_cls: Type[Model], input_paths: Sequence[str], postprocess: Optional[str]):
from furiosa.runtime.sync import create_runner

warning = """WARN: the benchmark results may depend on the number of input samples,
sizes of the images, and a machine where this benchmark is running."""
if postprocess:
Expand Down
16 changes: 14 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,20 @@ Documentation = "https://furiosa-ai.github.io/furiosa-models/latest/"
[tool.flit.module]
name = "furiosa.models"

[tool.flit.external-data]
directory = "furiosa/models/data"
[tool.flit.sdist]
exclude = [
'.dvc',
'.dvcignore',
'.github',
'.gitignore',
'Makefile',
'ci-constraints.txt',
'docker',
'docs',
'mkdocs.yml',
'tekton',
'tests',
]

[tool.pytest.ini_options]
addopts = "--benchmark-autosave"
Expand Down

0 comments on commit 78ff0a8

Please sign in to comment.