Skip to content
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

fix utils and doc #156

Merged
merged 2 commits into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ dpl/output/
.viminfo

# inner egs
inner
delta_inner
4 changes: 2 additions & 2 deletions docs/development/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ Before commit golang code, plase using `go fmt` and `go vec` to format and lint

## Logging guideline

For `python` using [abseil-py](https://github.com/abseil/abseil-py).
For `python` using [abseil-py](https://github.com/abseil/abseil-py), [more info](https://abseil.io/docs/python/).

For C++ using [abseil-cpp](https://github.com/abseil/abseil-cpp).
For C++ using [abseil-cpp](https://github.com/abseil/abseil-cpp), [more info](https://abseil.io/docs/cpp/).

For Golang using [glog](https://github.com/golang/glog).

Expand Down
6 changes: 4 additions & 2 deletions utils/pb_pbtxt.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ def main(_):
logging.info(f"dump graph to {dump_dir}")

if __name__ == '__main__':
# flags usage: https://abseil.io/docs/python/guides/flags
logging.set_verbosity(logging.INFO)
flags.DEFINE_string('graph', default=None, help='graph.pb file name')
flags.DEFINE_bool('binary_in', default=True, help='input graph is binary or not')
flags.DEFINE_string('graph', default=None, help='graph.pb file name', short_name='g')
flags.DEFINE_bool('binary_in', default=True, help='input graph is binary or not', short_name='b')
flags.mark_flag_as_required('graph')

app.run(main)
11 changes: 7 additions & 4 deletions utils/run_saved_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
''' Saved & Frozen & Checkpoint model Evaluater'''
import os
from absl import logging
from absl import flags
from absl import app

from delta import utils
Expand Down Expand Up @@ -59,10 +60,12 @@ def main(_):
def define_flags():
''' define flags for evaluator'''
# The GPU devices which are visible for current process
app.flags.DEFINE_string('gpu', '', 'same to CUDA_VISIBLE_DEVICES')
app.flags.DEFINE_string('config', 'conf/xxx.yml', help='path to yaml config file')
app.flags.DEFINE_string('mode', 'eval', 'one of eval, infer, eval_and_infer')
app.flags.DEFINE_boolean('debug', False, 'debug mode')
flags.DEFINE_string('gpu', '', 'same to CUDA_VISIBLE_DEVICES')
flags.DEFINE_string('config', None, help='path to yaml config file')
flags.DEFINE_enum('mode', 'eval',['eval', 'infer', 'eval_and_infer'], 'eval or infer')
flags.DEFINE_bool('debug', False, 'debug mode')
# https://github.com/abseil/abseil-py/blob/master/absl/flags/_validators.py#L330
flags.mark_flags_as_required(['config', 'mode'])

if __name__ == '__main__':
logging.set_verbosity(logging.INFO)
Expand Down