Skip to content

Commit 3bacf86

Browse files
esythanroot
authored andcommitted
code style
1 parent 94cfa75 commit 3bacf86

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

tools/onoff_diff/get_xbox_model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
# fout.close()
2727

28+
2829
def get_xbox_model(infile, outfile):
2930
fout = open(outfile, 'w')
3031
out_list = ['0', '1', '0', '1']
@@ -51,11 +52,12 @@ def get_xbox_model(infile, outfile):
5152
fout.write('{}\t{}\n'.format(out_str1, out_str2))
5253
fout.close()
5354

55+
5456
if __name__ == '__main__':
5557
import argparse
5658
parser = argparse.ArgumentParser()
5759
parser.add_argument('-i', help='输入文件,cube结果', dest='infile', required=True)
5860
parser.add_argument(
5961
'-o', help='输出文件,xbox模型', dest='outfile', required=True)
6062
args = parser.parse_args()
61-
get_xbox_model(args.infile, args.outfile)
63+
get_xbox_model(args.infile, args.outfile)

tools/onoff_diff/onoff_diff.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def get_data_from_log(online_log_file, origin_file):
5959
res[insid] = {}
6060
res[insid][var_name] = (length, data)
6161
# print("online log:", res.keys())
62-
62+
6363
return res
6464

6565

@@ -146,17 +146,20 @@ def onoff_max_diff(log_data, model_data, ins_id):
146146
if max_diff < diff:
147147
max_diff = diff
148148
if max_diff > 2e-5:
149-
print("ins_id:{}, var_name:{}: {}".format(ins_id, var_name, max_diff))
149+
print("ins_id:{}, var_name:{}: {}".format(ins_id, var_name,
150+
max_diff))
150151

151152

152153
if __name__ == '__main__':
153154
import argparse
154155
parser = argparse.ArgumentParser()
155-
parser.add_argument('-l', help='线上日志文件', dest='online_log_file', required=True)
156+
parser.add_argument(
157+
'-l', help='线上日志文件', dest='online_log_file', required=True)
156158
parser.add_argument(
157159
'-m', help='模型dump文件', dest='model_dump_file', required=True)
158160
parser.add_argument('-v', help='所有var文件', dest='var_file', required=True)
159-
parser.add_argument('-o', help='offline原始数据文件', dest='origin_file', required=True)
161+
parser.add_argument(
162+
'-o', help='offline原始数据文件', dest='origin_file', required=True)
160163
args = parser.parse_args()
161164
log_data = get_data_from_log(args.online_log_file, args.origin_file)
162165
model_data = get_data_from_model(args.model_dump_file)

tools/onoff_diff/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fleetrun --server_num=1 --worker_num=1 ../../../tools/static_ps_offline_infer.py
3939
OFFLINE_DUMP_PATH=$MODEL_PATH/dump_offline_infer
4040
cat $OFFLINE_DUMP_PATH/part* > $TOOL_PATH/data/log.offline
4141

42-
echo "online offline diff..."
42+
echo "online offline diff..."
4343
cd $TOOL_PATH
4444
python3 onoff_diff.py -l ./data/log.online \
4545
-m ./data/log.offline \

tools/static_ps_offline_infer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def run_offline_infer(self):
119119

120120
self.exe.run(paddle.static.default_startup_program())
121121
fleet.init_worker()
122-
122+
123123
init_model_path = config.get("runner.init_model_path")
124124
fleet.load_model(init_model_path, mode=0)
125125

0 commit comments

Comments
 (0)