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
6ea1a632
Commit
6ea1a632
authored
4 years ago
by
Yifan Zhao
Browse files
Options
Downloads
Patches
Plain Diff
Made _load inplace for easier inheritance
parent
4c5b8d9b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
predtuner/modeledapp.py
+4
-5
4 additions, 5 deletions
predtuner/modeledapp.py
with
4 additions
and
5 deletions
predtuner/modeledapp.py
+
4
−
5
View file @
6ea1a632
...
...
@@ -291,7 +291,7 @@ class QoSModelP2(IQoSModel):
def
_init
(
self
):
if
self
.
storage
and
self
.
storage
.
is_file
():
self
.
qos_df
,
self
.
baseline_qos
=
self
.
_load
(
self
.
storage
)
self
.
_load
(
self
.
storage
)
else
:
knob_names
=
[
k
.
name
for
k
in
self
.
app
.
knobs
]
self
.
qos_df
=
pd
.
DataFrame
(
index
=
self
.
app
.
ops
,
columns
=
knob_names
)
...
...
@@ -306,11 +306,9 @@ class QoSModelP2(IQoSModel):
self
.
_save
(
self
.
storage
)
super
().
_init
()
def
_load
(
self
,
path
:
Path
)
->
Tuple
[
pd
.
DataFrame
,
float
]
:
def
_load
(
self
,
path
:
Path
):
with
path
.
open
()
as
f
:
data
=
json
.
load
(
f
)
df
=
pd
.
DataFrame
(
data
[
"
df
"
])
baseline_qos
=
float
(
data
[
"
bqos
"
])
if
"
app_name
"
in
data
:
name
=
data
[
"
app_name
"
]
if
self
.
app
.
name
!=
name
:
...
...
@@ -321,7 +319,8 @@ class QoSModelP2(IQoSModel):
else
:
msg_logger
.
warning
(
"
Loaded profile does not have app name identifier
"
)
msg_logger
.
info
(
f
"
Model
{
self
.
name
}
loaded saved model at
{
path
}
"
)
return
df
,
baseline_qos
self
.
qos_df
=
pd
.
DataFrame
(
data
[
"
df
"
])
self
.
baseline_qos
=
float
(
data
[
"
bqos
"
])
def
_save
(
self
,
path
:
Path
):
import
os
...
...
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