|
|
@ -35,12 +35,12 @@ from deepspeech.utils import error_rate
|
|
|
|
from deepspeech.utils import layer_tools
|
|
|
|
from deepspeech.utils import layer_tools
|
|
|
|
from deepspeech.utils import mp_tools
|
|
|
|
from deepspeech.utils import mp_tools
|
|
|
|
from deepspeech.utils.log import Log
|
|
|
|
from deepspeech.utils.log import Log
|
|
|
|
logger = Log(__name__).getlog()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import auto_log
|
|
|
|
import auto_log
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
from paddle import inference
|
|
|
|
from paddle import inference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger = Log(__name__).getlog()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DeepSpeech2Trainer(Trainer):
|
|
|
|
class DeepSpeech2Trainer(Trainer):
|
|
|
@ -228,13 +228,12 @@ class DeepSpeech2Tester(DeepSpeech2Trainer):
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, config, args):
|
|
|
|
def __init__(self, config, args):
|
|
|
|
super().__init__(config, args)
|
|
|
|
super().__init__(config, args)
|
|
|
|
# added by hyx
|
|
|
|
|
|
|
|
pid = os.getpid()
|
|
|
|
pid = os.getpid()
|
|
|
|
|
|
|
|
gpu_id = int(os.environ['CUDA_VISIBLE_DEVICES'].split(',')[0])
|
|
|
|
infer_config = inference.Config()
|
|
|
|
infer_config = inference.Config()
|
|
|
|
infer_config.enable_use_gpu(10000, 2)
|
|
|
|
infer_config.enable_use_gpu(100, gpu_id)
|
|
|
|
logger = None
|
|
|
|
|
|
|
|
autolog = auto_log.AutoLogger(
|
|
|
|
autolog = auto_log.AutoLogger(
|
|
|
|
model_name="tiny_s0",
|
|
|
|
model_name="deepspeech2",
|
|
|
|
model_precision="fp32",
|
|
|
|
model_precision="fp32",
|
|
|
|
batch_size=config.decoding.batch_size,
|
|
|
|
batch_size=config.decoding.batch_size,
|
|
|
|
data_shape="dynamic",
|
|
|
|
data_shape="dynamic",
|
|
|
@ -242,13 +241,14 @@ class DeepSpeech2Tester(DeepSpeech2Trainer):
|
|
|
|
inference_config=infer_config,
|
|
|
|
inference_config=infer_config,
|
|
|
|
pids=pid,
|
|
|
|
pids=pid,
|
|
|
|
process_name=None,
|
|
|
|
process_name=None,
|
|
|
|
gpu_ids=2,
|
|
|
|
gpu_ids=gpu_id,
|
|
|
|
time_keys=[
|
|
|
|
time_keys=[
|
|
|
|
'preprocess_time', 'inference_time', 'postprocess_time'
|
|
|
|
'preprocess_time', 'inference_time', 'postprocess_time'
|
|
|
|
],
|
|
|
|
],
|
|
|
|
warmup=0)
|
|
|
|
warmup=0)
|
|
|
|
self.autolog = autolog
|
|
|
|
self.autolog = autolog
|
|
|
|
logger = autolog.logger
|
|
|
|
logger = autolog.logger
|
|
|
|
|
|
|
|
logger.info("gpu_id:{}".format(gpu_id))
|
|
|
|
|
|
|
|
|
|
|
|
def ordid2token(self, texts, texts_len):
|
|
|
|
def ordid2token(self, texts, texts_len):
|
|
|
|
""" ord() id to chr() chr """
|
|
|
|
""" ord() id to chr() chr """
|
|
|
@ -291,6 +291,7 @@ class DeepSpeech2Tester(DeepSpeech2Trainer):
|
|
|
|
self.autolog.times.stamp()
|
|
|
|
self.autolog.times.stamp()
|
|
|
|
self.autolog.times.stamp()
|
|
|
|
self.autolog.times.stamp()
|
|
|
|
self.autolog.times.end()
|
|
|
|
self.autolog.times.end()
|
|
|
|
|
|
|
|
|
|
|
|
for utt, target, result in zip(utts, target_transcripts,
|
|
|
|
for utt, target, result in zip(utts, target_transcripts,
|
|
|
|
result_transcripts):
|
|
|
|
result_transcripts):
|
|
|
|
errors, len_ref = errors_func(target, result)
|
|
|
|
errors, len_ref = errors_func(target, result)
|
|
|
|