|
6 | 6 | from onmt.opennmt import OpenNMTDecoder
|
7 | 7 |
|
8 | 8 | import logging
|
9 |
| -logging.basicConfig(level=logging.INFO) |
| 9 | + |
10 | 10 |
|
11 | 11 | class TranslationRequest:
|
12 | 12 | def __init__(self, source, suggestions=None):
|
@@ -102,37 +102,37 @@ def run_main():
|
102 | 102 | parser.add_argument('-g', '-gpu', dest='gpu', metavar='GPU', help='the index of the GPU to use',
|
103 | 103 | default=-1)
|
104 | 104 |
|
105 |
| - parser.add_argument('-beam_size', type=int, default=5, |
106 |
| - help='Beam size') |
| 105 | + parser.add_argument('-beam_size', type=int, default=5, |
| 106 | + help='Beam size') |
107 | 107 | parser.add_argument('-batch_size', type=int, default=30,
|
108 |
| - help='Batch size') |
| 108 | + help='Batch size') |
109 | 109 | parser.add_argument('-max_sent_length', type=int, default=100,
|
110 |
| - help='Maximum sentence length.') |
| 110 | + help='Maximum sentence length.') |
111 | 111 | parser.add_argument('-replace_unk', action="store_true",
|
112 |
| - help="""Replace the generated UNK tokens with the source |
| 112 | + help="""Replace the generated UNK tokens with the source |
113 | 113 | token that had the highest attention weight. If phrase_table
|
114 | 114 | is provided, it will lookup the identified source token and
|
115 | 115 | give the corresponding target token. If it is not provided
|
116 | 116 | (or the identified source token does not exist in the
|
117 | 117 | table) then it will copy the source token""")
|
118 | 118 | parser.add_argument('-verbose', action="store_true",
|
119 |
| - help='Print scores and predictions for each sentence') |
| 119 | + help='Print scores and predictions for each sentence') |
120 | 120 | parser.add_argument('-dump_beam', type=str, default="",
|
121 |
| - help='File to dump beam information to.') |
| 121 | + help='File to dump beam information to.') |
122 | 122 | parser.add_argument('-n_best', type=int, default=1,
|
123 |
| - help="""If verbose is set, will output the n_best |
| 123 | + help="""If verbose is set, will output the n_best |
124 | 124 | decoded sentences""")
|
125 | 125 | parser.add_argument('-tuning_epochs', type=int, default=5,
|
126 |
| - help='Number of tuning epochs') |
| 126 | + help='Number of tuning epochs') |
127 | 127 |
|
128 |
| -#seed for generating random numbers |
129 |
| - parser.add_argument('-seed', type=int, default=3435, |
130 |
| - help="Random seed for generating random numbers (-1 for un-defined the seed; default is 3435); ") |
| 128 | + # seed for generating random numbers |
| 129 | + parser.add_argument('-seed', type=int, default=3435, |
| 130 | + help="Random seed for generating random numbers (-1 for un-defined the seed; default is 3435); ") |
131 | 131 |
|
132 | 132 | parser.add_argument('-tunable', action="store_true",
|
133 |
| - help='Enable fine tuning') |
| 133 | + help='Enable fine tuning') |
134 | 134 | parser.add_argument('-reset', action="store_true",
|
135 |
| - help='Reset model to the original model after each translation') |
| 135 | + help='Reset model to the original model after each translation') |
136 | 136 |
|
137 | 137 | args = parser.parse_args()
|
138 | 138 |
|
|
0 commit comments