Skip to content

Commit cbd344e

Browse files
committed
fix codestyel
1 parent 793b8ba commit cbd344e

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

examples/text_correction/ernie-csc/predict.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,42 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
import os
16-
1715
import argparse
18-
import numpy as np
1916
from functools import partial
2017

2118
import paddle
22-
from paddle import inference
23-
from paddlenlp.data import Stack, Tuple, Pad, Vocab
24-
from paddlenlp.transformers import ErnieTokenizer
25-
2619
from utils import convert_example, parse_decode
2720

28-
# yapf: disable
21+
from paddlenlp.data import Pad, Stack, Tuple, Vocab
22+
from paddlenlp.transformers import ErnieTokenizer
23+
2924
parser = argparse.ArgumentParser(__doc__)
30-
parser.add_argument("--model_file", type=str, required=True, default='./static_graph_params.pdmodel', help="The path to model info in static graph.")
31-
parser.add_argument("--params_file", type=str, required=True, default='./static_graph_params.pdiparams', help="The path to parameters in static graph.")
25+
parser.add_argument(
26+
"--model_file",
27+
type=str,
28+
required=True,
29+
default="./static_graph_params.pdmodel",
30+
help="The path to model info in static graph.",
31+
)
32+
parser.add_argument(
33+
"--params_file",
34+
type=str,
35+
required=True,
36+
default="./static_graph_params.pdiparams",
37+
help="The path to parameters in static graph.",
38+
)
3239
parser.add_argument("--batch_size", type=int, default=2, help="The number of sequences contained in a mini-batch.")
3340
parser.add_argument("--max_seq_len", type=int, default=64, help="Number of words of the longest seqence.")
34-
parser.add_argument("--device", default="gpu", type=str, choices=["cpu", "gpu"] ,help="The device to select to train the model, is must be cpu/gpu.")
41+
parser.add_argument(
42+
"--device",
43+
default="gpu",
44+
type=str,
45+
choices=["cpu", "gpu"],
46+
help="The device to select to train the model, is must be cpu/gpu.",
47+
)
3548
parser.add_argument("--pinyin_vocab_file_path", type=str, default="pinyin_vocab.txt", help="pinyin vocab file path")
3649

3750
args = parser.parse_args()
38-
# yapf: enable
3951

4052

4153
class Predictor(object):

0 commit comments

Comments
 (0)