diff --git a/research/nlp/hypertext/README_CN.md b/research/nlp/hypertext/README_CN.md index 8dd62ee8ca6c4e7188fc92edbc153659385afc80..97ad16c7db43d40900dfc03f32f0d6b123010d63 100644 --- a/research/nlp/hypertext/README_CN.md +++ b/research/nlp/hypertext/README_CN.md @@ -238,23 +238,25 @@ python eval.py --datasetdir ./data/iflytek_public --datasetType iflytek --model ```shell tnews -python export.py --modelPath ./output/hypertext_tnews.ckpt --datasetType tnews --device Ascend --batch_size 1 +python export.py --modelPath ./output/hypertext_tnews.ckpt --datasetType tnews --device Ascend --batch_size 1 --file_format MINDIR iflytek -python export.py --modelPath ./output/hypertext_iflytek.ckpt --datasetType iflytek --device Ascend --batch_size 1 +python export.py --modelPath ./output/hypertext_iflytek.ckpt --datasetType iflytek --device Ascend --batch_size 1 --file_format MINDIR ``` - GPU澶勭悊鍣ㄧ幆澧冭繍琛� ```shell tnews -python export.py --modelPath ./output/hypertext_tnews.ckpt --datasetType tnews --device GPU +python export.py --modelPath ./output/hypertext_tnews.ckpt --datasetType tnews --device GPU --file_format MINDIR iflytek -python export.py --modelPath ./output/hypertext_iflytek.ckpt --datasetType iflytek --device GPU +python export.py --modelPath ./output/hypertext_iflytek.ckpt --datasetType iflytek --device GPU --file_format MINDIR ``` +娉ㄦ剰锛歚file_format`蹇呴』鍦╗"AIR", "MINDIR"]涓繘琛岄€夋嫨銆� + ## 鍦ˋscend310鎵ц鎺ㄧ悊 -鍦ㄦ墽琛屾帹鐞嗗墠锛宮indir鏂囦欢蹇呴』閫氳繃`export.py`鑴氭湰瀵煎嚭銆備互涓嬪睍绀轰簡浣跨敤minir妯″瀷鎵ц鎺ㄧ悊鐨勭ず渚嬨€� +鍦ㄦ墽琛屾帹鐞嗗墠锛宮indir鏂囦欢蹇呴』閫氳繃`export.py`鑴氭湰瀵煎嚭銆備互涓嬪睍绀轰簡浣跨敤mindir妯″瀷鎵ц鎺ㄧ悊鐨勭ず渚嬨€� 浣跨敤閰嶇疆鏂囦欢榛樿鐨別xport_batch_size瀵煎嚭MINDIR鏂囦欢 ```shell diff --git a/research/nlp/hypertext/export.py b/research/nlp/hypertext/export.py index 87b6f5bdc47af4e7633e98a376791c4c7b57adba..74e0aaf5562914934328bbe60acbce740ccd6f7c 100644 --- a/research/nlp/hypertext/export.py +++ b/research/nlp/hypertext/export.py @@ -35,6 +35,7 @@ parser.add_argument("--file_name", default="hypertext", help="output file name.") parser.add_argument('--device', default='GPU', type=str, help='device GPU Ascend') +parser.add_argument('--file_format', default="MINDIR", type=str, chioces=['AIR', "MINDIR"], help="file format") args = parser.parse_args() config = Config(None, None, args.device) @@ -79,7 +80,7 @@ def run_export(): ht_infer = HyperTextTextInferExportCell(hmodel) x1 = Tensor(np.ones((args.batch_size, config.max_length)).astype(np.int32)) x2 = Tensor(np.ones((args.batch_size, config.max_length)).astype(np.int32)) - export(ht_infer, x1, x2, file_name=file_name, file_format='MINDIR') + export(ht_infer, x1, x2, file_name=file_name, file_format=args.file_format) if __name__ == '__main__':