|
|
|
@ -12,7 +12,6 @@
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
import argparse
|
|
|
|
|
import ast
|
|
|
|
|
import os
|
|
|
|
|
import re
|
|
|
|
|
from collections import OrderedDict
|
|
|
|
@ -122,10 +121,15 @@ class TextExecutor(BaseExecutor):
|
|
|
|
|
default=paddle.get_device(),
|
|
|
|
|
help='Choose device to execute model inference.')
|
|
|
|
|
self.parser.add_argument(
|
|
|
|
|
'-d',
|
|
|
|
|
'--job_dump_result',
|
|
|
|
|
type=ast.literal_eval,
|
|
|
|
|
default=False,
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='Save job result into file.')
|
|
|
|
|
self.parser.add_argument(
|
|
|
|
|
'-v',
|
|
|
|
|
'--verbose',
|
|
|
|
|
action='store_true',
|
|
|
|
|
help='Increase logger verbosity of current task.')
|
|
|
|
|
|
|
|
|
|
def _get_pretrained_path(self, tag: str) -> os.PathLike:
|
|
|
|
|
"""
|
|
|
|
@ -270,7 +274,9 @@ class TextExecutor(BaseExecutor):
|
|
|
|
|
ckpt_path = parser_args.ckpt_path
|
|
|
|
|
punc_vocab = parser_args.punc_vocab
|
|
|
|
|
device = parser_args.device
|
|
|
|
|
job_dump_result = parser_args.job_dump_result
|
|
|
|
|
|
|
|
|
|
if not parser_args.verbose:
|
|
|
|
|
self.disable_task_loggers()
|
|
|
|
|
|
|
|
|
|
task_source = self.get_task_source(parser_args.input)
|
|
|
|
|
task_results = OrderedDict()
|
|
|
|
@ -286,7 +292,7 @@ class TextExecutor(BaseExecutor):
|
|
|
|
|
task_results[id_] = f'{e.__class__.__name__}: {e}'
|
|
|
|
|
|
|
|
|
|
self.process_task_results(parser_args.input, task_results,
|
|
|
|
|
job_dump_result)
|
|
|
|
|
parser_args.job_dump_result)
|
|
|
|
|
|
|
|
|
|
if has_exceptions:
|
|
|
|
|
return False
|
|
|
|
|