|
|
@ -12,7 +12,6 @@
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
# limitations under the License.
|
|
|
|
"""Contains DeepSpeech2 and DeepSpeech2Online model."""
|
|
|
|
"""Contains DeepSpeech2 and DeepSpeech2Online model."""
|
|
|
|
import random
|
|
|
|
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
from collections import defaultdict
|
|
|
|
from collections import defaultdict
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
@ -54,7 +53,6 @@ class DeepSpeech2Trainer(Trainer):
|
|
|
|
weight_decay=1e-6, # the coeff of weight decay
|
|
|
|
weight_decay=1e-6, # the coeff of weight decay
|
|
|
|
global_grad_clip=5.0, # the global norm clip
|
|
|
|
global_grad_clip=5.0, # the global norm clip
|
|
|
|
n_epoch=50, # train epochs
|
|
|
|
n_epoch=50, # train epochs
|
|
|
|
seed=1024, #train seed
|
|
|
|
|
|
|
|
))
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
|
if config is not None:
|
|
|
|
if config is not None:
|
|
|
@ -63,13 +61,6 @@ class DeepSpeech2Trainer(Trainer):
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, config, args):
|
|
|
|
def __init__(self, config, args):
|
|
|
|
super().__init__(config, args)
|
|
|
|
super().__init__(config, args)
|
|
|
|
if config.training.seed is not None:
|
|
|
|
|
|
|
|
self.set_seed(config.training.seed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_seed(self, seed):
|
|
|
|
|
|
|
|
np.random.seed(seed)
|
|
|
|
|
|
|
|
random.seed(seed)
|
|
|
|
|
|
|
|
paddle.seed(seed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def train_batch(self, batch_index, batch_data, msg):
|
|
|
|
def train_batch(self, batch_index, batch_data, msg):
|
|
|
|
start = time.time()
|
|
|
|
start = time.time()
|
|
|
|