Skip to content

Commit 0449b54

Browse files
authored
Move the performance module and Device class under the run module (#215)
* Move the performance module and Device class under the run module * rev version number * Allow plugin benchmark tools to override the built-in one
1 parent de5439b commit 0449b54

File tree

9 files changed

+15
-9
lines changed

9 files changed

+15
-9
lines changed

examples/cli/plugins/example_combined/turnkeyml_plugin_example_combined/runtime.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import turnkeyml.common.exceptions as exp
99
import turnkeyml.common.filesystem as fs
1010
from turnkeyml.run.onnxrt.within_conda import dummy_inputs
11-
from turnkeyml.common.performance import MeasuredPerformance
11+
from turnkeyml.run.performance import MeasuredPerformance
1212

1313

1414
combined_rt_name = "example-combined-rt"

examples/cli/plugins/example_rt/turnkeyml_plugin_example_rt/runtime.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import numpy as np
33
from turnkeyml.run.basert import BaseRT
4-
from turnkeyml.common.performance import MeasuredPerformance
4+
from turnkeyml.run.performance import MeasuredPerformance
55
import turnkeyml.common.exceptions as exp
66
from turnkeyml.common.filesystem import Stats
77

src/turnkeyml/run/basert.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from abc import ABC, abstractmethod
88
import torch
99
import numpy as np
10-
from turnkeyml.common.performance import MeasuredPerformance, Device
10+
from turnkeyml.run.performance import MeasuredPerformance, Device
1111
import turnkeyml.common.build as build
1212
import turnkeyml.common.exceptions as exp
1313
import turnkeyml.common.filesystem as fs

src/turnkeyml/run/benchmark_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
apply_default_runtime,
1111
)
1212
import turnkeyml.cli.parser_helpers as parser_helpers
13-
from turnkeyml.common.performance import Device, parse_device
13+
from turnkeyml.run.performance import Device, parse_device
1414

1515
default_iterations = 100
1616
benchmark_default_device = "x86"
File renamed without changes.

src/turnkeyml/run/torchrt/runtime.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import torch
88
import numpy as np
99
from turnkeyml.run.basert import BaseRT
10-
from turnkeyml.common.performance import MeasuredPerformance
10+
from turnkeyml.run.performance import MeasuredPerformance
1111
from turnkeyml.run.onnxrt.execute import get_cpu_specs
1212
import turnkeyml.common.build as build
1313
import turnkeyml.common.exceptions as exp

src/turnkeyml/sequence/tool_plugins.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import turnkeyml.tools.onnx as onnx_tools
33
import turnkeyml.common.plugins as plugins
44
import turnkeyml.tools.management_tools as mgmt
5-
from turnkeyml.run.benchmark_model import Benchmark
65
from turnkeyml.tools.discovery import Discover
76
import turnkeyml.tools.report as report
87
from turnkeyml.tools.load_build import LoadBuild
@@ -16,7 +15,6 @@
1615
mgmt.Cache,
1716
mgmt.ModelsLocation,
1817
report.Report,
19-
Benchmark,
2018
Discover,
2119
export.ExportPytorchModel,
2220
onnx_tools.OptimizeOnnxModel,
@@ -40,3 +38,11 @@
4038
)
4139

4240
SUPPORTED_TOOLS.append(tool_class)
41+
42+
# Give a "benchmark" tool installed by a plugin priority over
43+
# a "benchmark" tool built into turnkeyml
44+
tool_names = [tool.unique_name for tool in SUPPORTED_TOOLS]
45+
if "benchmark" not in tool_names:
46+
from turnkeyml.run.benchmark_model import Benchmark
47+
48+
SUPPORTED_TOOLS.append(Benchmark)

src/turnkeyml/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.0.5"
1+
__version__ = "3.0.6"

test/unit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import os
77
import sys
88
import turnkeyml.common.filesystem as filesystem
9-
import turnkeyml.common.performance as performance
109
import turnkeyml.common.build as build
10+
import turnkeyml.run.performance as performance
1111
import turnkeyml.run.plugin_helpers as plugin_helpers
1212

1313

0 commit comments

Comments
 (0)