Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
predtuner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
predtuner
Commits
0d518aba
Commit
0d518aba
authored
4 years ago
by
Yifan Zhao
Browse files
Options
Downloads
Patches
Plain Diff
Added progress bar support
parent
226ef7b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
predtuner/torchapp.py
+12
-3
12 additions, 3 deletions
predtuner/torchapp.py
test/test_model_zoo_acc.py
+1
-1
1 addition, 1 deletion
test/test_model_zoo_acc.py
with
13 additions
and
4 deletions
predtuner/torchapp.py
+
12
−
3
View file @
0d518aba
...
...
@@ -9,8 +9,14 @@ from torch.utils.data.dataloader import DataLoader
from
._logging
import
PathLike
from
.approxapp
import
ApproxKnob
,
BaselineKnob
,
KnobsT
from
.modeledapp
import
(
IPerfModel
,
IQoSModel
,
LinearPerfModel
,
ModeledApp
,
QoSModelP1
,
QoSModelP2
)
from
.modeledapp
import
(
IPerfModel
,
IQoSModel
,
LinearPerfModel
,
ModeledApp
,
QoSModelP1
,
QoSModelP2
,
)
from
.torchutil
import
ModuleIndexer
,
get_summary
,
move_to_device_recursively
...
...
@@ -161,14 +167,17 @@ class TorchApp(ModeledApp, abc.ABC):
@torch.no_grad
()
def
empirical_measure_qos_perf
(
self
,
with_approxes
:
KnobsT
,
is_test
:
bool
self
,
with_approxes
:
KnobsT
,
is_test
:
bool
,
progress
:
bool
=
False
)
->
Tuple
[
float
,
float
]:
"""
Measure the QoS and performance of Module with given approximation
empirically (i.e., by running the Module on the dataset).
"""
from
time
import
time_ns
from
tqdm
import
tqdm
dataloader
=
self
.
test_loader
if
is_test
else
self
.
tune_loader
if
progress
:
dataloader
=
tqdm
(
dataloader
)
approxed
=
self
.
_apply_knobs
(
with_approxes
)
qoses
=
[]
...
...
This diff is collapsed.
Click to expand it.
test/test_model_zoo_acc.py
+
1
−
1
View file @
0d518aba
...
...
@@ -34,5 +34,5 @@ class TestModelZooAcc(unittest.TestCase):
)
tune
=
DataLoader
(
dataset
,
batchsize
)
app
=
TorchApp
(
""
,
network
,
tune
,
tune
,
get_knobs_from_file
(),
accuracy
)
qos
,
_
=
app
.
measure_qos_perf
({},
False
)
qos
,
_
=
app
.
empirical_
measure_qos_perf
({},
False
,
True
)
self
.
assertAlmostEqual
(
qos
,
target_acc
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment