-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
clean-way-to-support-ce #1080
Merged
Merged
clean-way-to-support-ce #1080
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# This file is only used for continuous evaluation. | ||
|
||
rm -rf *_factor.txt | ||
model_file='model.py' | ||
python $model_file --batch_size 128 --pass_num 5 --device CPU | python _ce.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# this file is only used for continuous evaluation test! | ||
|
||
import os | ||
import sys | ||
sys.path.append(os.environ['ceroot']) | ||
from kpi import CostKpi, DurationKpi, AccKpi | ||
|
||
# NOTE kpi.py should shared in models in some way!!!! | ||
|
||
train_cost_kpi = CostKpi('train_cost', 0.02, actived=True) | ||
test_acc_kpi = AccKpi('test_acc', 0.005, actived=True) | ||
train_duration_kpi = DurationKpi('train_duration', 0.06, actived=True) | ||
train_acc_kpi = AccKpi('train_acc', 0.005, actived=True) | ||
|
||
tracking_kpis = [ | ||
train_acc_kpi, | ||
train_cost_kpi, | ||
test_acc_kpi, | ||
train_duration_kpi, | ||
] | ||
|
||
def parse_log(log): | ||
''' | ||
This method should be implemented by model developers. | ||
|
||
The suggestion: | ||
|
||
each line in the log should be key, value, for example: | ||
|
||
" | ||
train_cost\t1.0 | ||
test_cost\t1.0 | ||
train_cost\t1.0 | ||
train_cost\t1.0 | ||
train_acc\t1.2 | ||
" | ||
''' | ||
for line in log.split('\n'): | ||
fs = line.strip().split('\t') | ||
print (fs) | ||
if len(fs) == 3 and fs[0] == 'kpis': | ||
kpi_name = fs[1] | ||
kpi_value = float(fs[2]) | ||
yield kpi_name, kpi_value | ||
|
||
|
||
def log_to_ce(log): | ||
kpi_tracker = {} | ||
for kpi in tracking_kpis: | ||
kpi_tracker[kpi.name] = kpi | ||
|
||
for (kpi_name, kpi_value) in parse_log(log): | ||
print (kpi_name, kpi_value) | ||
kpi_tracker[kpi_name].add_record(kpi_value) | ||
kpi_tracker[kpi_name].persist() | ||
|
||
|
||
if __name__ == '__main__': | ||
log = sys.stdin.read() | ||
log_to_ce(log) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when will the kpi.py available? @Superjomn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the kpi.py file will be copyed from ce framework, when begin to run the model.