{"id":317056,"date":"2021-01-27T15:01:59","date_gmt":"2021-01-27T15:01:59","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=317056"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=317056","title":{"rendered":"\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0447\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u043d\u0430 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438. \u041e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0430\u0442\u0438\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432. \u041c\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0441\u0435\u0431\u0435 \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u044b \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0447\u0438 (ASR). \u041e\u0434\u0438\u043d \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p><strong>Nvidia NeMo \u2014&nbsp;<\/strong>\u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u0431\u0430\u0437\u0435 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 NeMo \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u0440\u0435\u0447\u0438 \u2014 \u043a\u043e\u043d\u043d\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0441\u0442\u0441\u043a\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f (CTC).<\/p>\n<p>\u0414\u043e \u0421\u0422\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0447\u0435\u0432\u044b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u043e \u043d\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u0442\u043e\u043a\u0435\u043d\u044b. \u0414\u0430\u043b\u0435\u0435 \u0442\u043e\u043a\u0435\u043d\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u043b\u0438\u0441\u044c, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0441\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u043e\u0434\u0438\u043d, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u0432\u044b\u0432\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0442\u0440\u0430\u0434\u0430\u043b\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043b\u043e\u0432\u043e \u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0431\u0443\u043a\u0432\u0430\u043c\u0438 \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u043b\u043e\u0441\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u043c \u043d\u0430 100%. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ab\u043a\u041e\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u00bb \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043a \u00ab\u043a\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u00bb.<\/p>\n<p>\u0421 CTC \u2014 \u0432\u0441\u0435 \u0435\u0449\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043e\u0434\u0438\u043d \u0442\u043e\u043a\u0435\u043d \u043d\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0440\u0435\u0447\u0438 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u0442\u043e\u043a\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c \u0433\u0434\u0435 \u0441\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0442\u043e\u043a\u0435\u043d\u044b. \u041f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0431\u0443\u043a\u0432\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u0432\u0435\u0440\u043d\u0443\u0442\u044b.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u044f \u0432\u0437\u044f\u043b \u043e\u0434\u043d\u0443 \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 (Jasper 10\u00d75) \u0438 \u043e\u0431\u0443\u0447\u0438\u043b \u0435\u0435 \u0441 \u043d\u0443\u043b\u044f. \u0414\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043d\u0430\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u043e\u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0438\u0445 \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u0431\u0430\u0446\u0438\u044e.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b-\u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0435 \u0438 \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u0431\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u0424\u0430\u0439\u043b \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442:<\/p>\n<pre><code class=\"python\">{{\"audio_filepath\": \"path\/to\/audio.wav\", \"duration\": 3.45, \"text\": \"sometext\"}\u2026{\"audio_filepath\": \"path\/to\/audio.wav\", \"duration\": 3.45, \"text\": \"sometext\"}}<\/code><\/pre>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 *.wav. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0431\u0435\u0436\u0430\u0442\u044c\u0441\u044f \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u043f\u0435\u0440\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u044b \u0441 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"python\">def convertToWav(self, ext):         if not os.path.exists(self.datadir + '\/dataset'):             tar = tarfile.open(self.an4Path);             tar.extractall(path=self.datadir);         sphList = glob.glob(self.datadir + '\/dataset\/**\/*' + ext, recursive=True);         for sph in sphList:             wav = sph[:-4] + '.wav';             cmd = [\"sox\", sph, wav];             subprocess.run(cmd);             print('renamed ' + ext + ' to ' + wav);<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 get<em>duration(filename=audio<\/em>path) \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Librosa, \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u0431\u0430\u0446\u0438\u0438 \u0438 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0430\u043c \u043d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d:<\/p>\n<pre><code class=\"python\">def buildManifest(self, transcript_path, manifest_path, wav_path):         with open(transcript_paths, 'r') as fin:             with open(manifest_path, 'w') as fout:                 for line in fin:                     transcript = line[: line.find('(')-1].lower();                     transcript = transcript.replace('&amp;lt;s&gt;', '').replace('&amp;lt;\/s&gt;', '');                     transcript = transcript.strip();                     file_id = line[line.find('(')+1 : -2];                     audio_path = os.path.join(self.datadir, wav_paths, file_id[file_id.find('-')+1 : file_id.rfind('-')], file_id +'.wav');                     duration = librosa.core.get_duration(filename=audio_path);                     metadata = {                         \"audio_filepath\": audio_path,                         \"duration\": duration,                         \"text\": transcript                     }                     print(metadata);                     json.dump(metadata, fout);                     fout.write('\\n');<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u044f \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<pre><code class=\"python\">config.yaml: name: &amp;amp;name \"Jasper10x5\" model:   sample_rate: &amp;amp;sample_rate 16000   labels: &amp;amp;labels [\" \", \"a\", \"\u0431\", \"\u0432\", \"\u0433\", \"\u0434\", \"\u0435\", \"\u0451\", \"\u0436\", \"\u0437\", \"\u0438\", \"\u0439\", \"\u043a\", \"\u043b\",                    \"\u043c\", \"\u043d\", \"\u043e\", \"\u043f\", \"\u0440\", \"\u0441\", \"\u0442\", \"\u0443\", \"\u0444\", \"\u0445\", \"\u0446\", \"\u0447\", \"\u0448\", \"\u0449\", \"\u044a\", \"\u044c\", \"\u044d\", \"\u044e\", \"\u044f\", \"'\"]  preprocessor:     _target_: nemo.collections.asr.modules.AudioToMelSpectrogramPreprocessor     normalize: \"per_feature\"     sample_rate: *sample_rate     features: &amp;amp;n_mels 64     n_fft: 512     frame_splicing: 1     dither: 0.00001     stft_conv: false<\/code><\/pre>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0435\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0443\u0442\u0438 \u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u0447\u043d\u043e\u043c\u0443 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0443 \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 pytorch_lighting \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">import nemo; class NemoASR:     def __init__(self, dataDir):         self.datadir = dataDir;         self.CONF_PATH = '.\/config.yaml';         yaml = YAML(typ=\"safe\");         with open(self.CONF_PATH) as f:             self.CONFIG = yaml.load(f);      def train(self, transcriptionPATH, manifestPATH, wavPATH, testTranscriptionPATH, testManifestPATH, testWavPATH):         print(\"begin train\");         train_transcripts = self.datadir + transcriptionPATH;         train_manifest = self.datadir + manifestPATH;         if not os.path.isfile(train_manifest):             self.buildManifest(train_transcripts, train_manifest, wavPATH);         test_transcripts = self.datadir + testTranscriptionPATH;         test_manifest = self.datadir + testManifestPATH;         if not os.path.isfile(test_manifest):             self.buildManifest(test_transcripts, test_manifest, testWavPATH);         # params from .\/config.yaml         self.CONFIG['model']['train_ds']['manifest_filepath'] = train_manifest;         self.CONFIG['model']['validation_ds']['manifest_filepath'] = test_manifest;         trainer = pl.Trainer(max_epochs=500, gpus=1);         self.model = nemo_asr.models.EncDecCTCModel(cfg=DictConfig(self.CONFIG['model']), trainer=trainer);         trainer.fit(self.model);         print(\"end train\"); #------------------------------------------------------------- nemoASR = NemoASR('.'); if (nemoASR.checkExistsDataSet()):     print('dataset loaded');     nemoASR.train('.\/dataset\/etc\/train.transcription',  '.\/dataset\/train_manifest.json','.\/dataset\/wav\/an4_clstk', '.\/dataset\/etc\/test.transcription', '.\/dataset\/test_manifest.json', '.\/dataset\/wav\/an4test_clstk');     nemoASR.model.save_to('.\/model.sbc');<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0447\u0438:<\/p>\n<pre><code class=\"python\">files = ['.\/an4\/wav\/an4_clstk\/mgah\/cen2-mgah-b.wav'];     for fname, transcription in zip(files, nemoASR.model.transcribe(paths2audio_files=files)):         print(f\"Audio in {fname} was recognized as: {transcription}\");<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u044b.<\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 NeMo \u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f&nbsp;<strong>\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 GPU;<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043a\u043e\u0434;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0418\u0437 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c<\/strong>&nbsp;\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u044f\u0436\u0435\u043b\u043e\u0432\u0435\u0441\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e, \u0447\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0432\u0435\u0436\u0438\u0439 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0431\u0435\u0442\u0430-\u0442\u0435\u0441\u0442\u0435.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u0440\u0435\u0447\u0438 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 ASR \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438. \u0421\u043c\u043e\u0433 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0447\u0438, \u043d\u043e \u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 (TTS) \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0434\u0438\u043a\u0442\u043e\u0440\u0430 (speaker recognition).<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/539488\/\"> https:\/\/habr.com\/ru\/post\/539488\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u043d\u0430 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430 \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438. \u041e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0430\u0442\u0438\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432. \u041c\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0441\u0435\u0431\u0435 \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u044b \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0447\u0438 (ASR). \u041e\u0434\u0438\u043d \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p><strong>Nvidia NeMo \u2014&nbsp;<\/strong>\u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430 \u0431\u0430\u0437\u0435 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<p>\u041c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 NeMo \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u0440\u0435\u0447\u0438 \u2014 \u043a\u043e\u043d\u043d\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0441\u0442\u0441\u043a\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f (CTC).<\/p>\n<p>\u0414\u043e \u0421\u0422\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0447\u0435\u0432\u044b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u043e \u043d\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u0442\u043e\u043a\u0435\u043d\u044b. \u0414\u0430\u043b\u0435\u0435 \u0442\u043e\u043a\u0435\u043d\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u043b\u0438\u0441\u044c, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0441\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u043e\u0434\u0438\u043d, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u0432\u044b\u0432\u043e\u0434 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0442\u0440\u0430\u0434\u0430\u043b\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043b\u043e\u0432\u043e \u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0431\u0443\u043a\u0432\u0430\u043c\u0438 \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u043b\u043e\u0441\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u043c \u043d\u0430 100%. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ab\u043a\u041e\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u00bb \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043a \u00ab\u043a\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u00bb.<\/p>\n<p>\u0421 CTC \u2014 \u0432\u0441\u0435 \u0435\u0449\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043e\u0434\u0438\u043d \u0442\u043e\u043a\u0435\u043d \u043d\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0440\u0435\u0447\u0438 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u0442\u043e\u043a\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c \u0433\u0434\u0435 \u0441\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0442\u043e\u043a\u0435\u043d\u044b. \u041f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0431\u0443\u043a\u0432\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u0432\u0435\u0440\u043d\u0443\u0442\u044b.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u044f \u0432\u0437\u044f\u043b \u043e\u0434\u043d\u0443 \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 (Jasper 10\u00d75) \u0438 \u043e\u0431\u0443\u0447\u0438\u043b \u0435\u0435 \u0441 \u043d\u0443\u043b\u044f. \u0414\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043d\u0430\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u043e\u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0438\u0445 \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u0431\u0430\u0446\u0438\u044e.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b-\u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0435 \u0438 \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u0431\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u0424\u0430\u0439\u043b \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442:<\/p>\n<pre><code class=\"python\">{{\"audio_filepath\": \"path\/to\/audio.wav\", \"duration\": 3.45, \"text\": \"sometext\"}\u2026{\"audio_filepath\": \"path\/to\/audio.wav\", \"duration\": 3.45, \"text\": \"sometext\"}}<\/code><\/pre>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 *.wav. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0431\u0435\u0436\u0430\u0442\u044c\u0441\u044f \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u043f\u0435\u0440\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u044b \u0441 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"python\">def convertToWav(self, ext):         if not os.path.exists(self.datadir + '\/dataset'):             tar = tarfile.open(self.an4Path);             tar.extractall(path=self.datadir);         sphList = glob.glob(self.datadir + '\/dataset\/**\/*' + ext, recursive=True);         for sph in sphList:             wav = sph[:-4] + '.wav';             cmd = [\"sox\", sph, wav];             subprocess.run(cmd);             print('renamed ' + ext + ' to ' + wav);<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0438 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 get<em>duration(filename=audio<\/em>path) \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Librosa, \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0442\u0440\u0430\u043d\u0441\u043a\u0440\u0438\u0431\u0430\u0446\u0438\u0438 \u0438 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0430\u043c \u043d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d:<\/p>\n<pre><code class=\"python\">def buildManifest(self, transcript_path, manifest_path, wav_path):         with open(transcript_paths, 'r') as fin:             with open(manifest_path, 'w') as fout:                 for line in fin:                     transcript = line[: line.find('(')-1].lower();                     transcript = transcript.replace('&amp;lt;s&gt;', '').replace('&amp;lt;\/s&gt;', '');                     transcript = transcript.strip();                     file_id = line[line.find('(')+1 : -2];                     audio_path = os.path.join(self.datadir, wav_paths, file_id[file_id.find('-')+1 : file_id.rfind('-')], file_id +'.wav');                     duration = librosa.core.get_duration(filename=audio_path);                     metadata = {                         \"audio_filepath\": audio_path,                         \"duration\": duration,                         \"text\": transcript                     }                     print(metadata);                     json.dump(metadata, fout);                     fout.write('\\n');<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u044f \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0435\u043b\u0438:<\/p>\n<pre><code class=\"python\">config.yaml: name: &amp;amp;name \"Jasper10x5\" model:   sample_rate: &amp;amp;sample_rate 16000   labels: &amp;amp;labels [\" \", \"a\", \"\u0431\", \"\u0432\", \"\u0433\", \"\u0434\", \"\u0435\", \"\u0451\", \"\u0436\", \"\u0437\", \"\u0438\", \"\u0439\", \"\u043a\", \"\u043b\",                    \"\u043c\", \"\u043d\", \"\u043e\", \"\u043f\", \"\u0440\", \"\u0441\", \"\u0442\", \"\u0443\", \"\u0444\", \"\u0445\", \"\u0446\", \"\u0447\", \"\u0448\", \"\u0449\", \"\u044a\", \"\u044c\", \"\u044d\", \"\u044e\", \"\u044f\", \"'\"]  preprocessor:     _target_: nemo.collections.asr.modules.AudioToMelSpectrogramPreprocessor     normalize: \"per_feature\"     sample_rate: *sample_rate     features: &amp;amp;n_mels 64     n_fft: 512     frame_splicing: 1     dither: 0.00001     stft_conv: false<\/code><\/pre>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0435\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0443\u0442\u0438 \u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u0447\u043d\u043e\u043c\u0443 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0443 \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 pytorch_lighting \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">import nemo; class NemoASR:     def __init__(self, dataDir):         self.datadir = dataDir;         self.CONF_PATH = '.\/config.yaml';         yaml = YAML(typ=\"safe\");         with open(self.CONF_PATH) as f:             self.CONFIG = yaml.load(f);      def train(self, transcriptionPATH, manifestPATH, wavPATH, testTranscriptionPATH, testManifestPATH, testWavPATH):         print(\"begin train\");         train_transcripts = self.datadir + transcriptionPATH;         train_manifest = self.datadir + manifestPATH;         if not os.path.isfile(train_manifest):             self.buildManifest(train_transcripts, train_manifest, wavPATH);         test_transcripts = self.datadir + testTranscriptionPATH;         test_manifest = self.datadir + testManifestPATH;         if not os.path.isfile(test_manifest):             self.buildManifest(test_transcripts, test_manifest, testWavPATH);         # params from .\/config.yaml         self.CONFIG['model']['train_ds']['manifest_filepath'] = train_manifest;         self.CONFIG['model']['validation_ds']['manifest_filepath'] = test_manifest;         trainer = pl.Trainer(max_epochs=500, gpus=1);         self.model = nemo_asr.models.EncDecCTCModel(cfg=DictConfig(self.CONFIG['model']), trainer=trainer);         trainer.fit(self.model);         print(\"end train\"); #------------------------------------------------------------- nemoASR = NemoASR('.'); if (nemoASR.checkExistsDataSet()):     print('dataset loaded');     nemoASR.train('.\/dataset\/etc\/train.transcription',  '.\/dataset\/train_manifest.json','.\/dataset\/wav\/an4_clstk', '.\/dataset\/etc\/test.transcription', '.\/dataset\/test_manifest.json', '.\/dataset\/wav\/an4test_clstk');     nemoASR.model.save_to('.\/model.sbc');<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0447\u0438:<\/p>\n<pre><code class=\"python\">files = ['.\/an4\/wav\/an4_clstk\/mgah\/cen2-mgah-b.wav'];     for fname, transcription in zip(files, nemoASR.model.transcribe(paths2audio_files=files)):         print(f\"Audio in {fname} was recognized as: {transcription}\");<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u044b.<\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 NeMo \u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0434\u043b\u044f \u0441\u0435\u0431\u044f&nbsp;<strong>\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 GPU;<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043a\u043e\u0434;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0418\u0437 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c<\/strong>&nbsp;\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u044f\u0436\u0435\u043b\u043e\u0432\u0435\u0441\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e, \u0447\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0432\u0435\u0436\u0438\u0439 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0431\u0435\u0442\u0430-\u0442\u0435\u0441\u0442\u0435.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u0440\u0435\u0447\u0438 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 ASR \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438. \u0421\u043c\u043e\u0433 \u043e\u0431\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0445 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0447\u0438, \u043d\u043e \u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 (TTS) \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0434\u0438\u043a\u0442\u043e\u0440\u0430 (speaker recognition).<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/539488\/\"> https:\/\/habr.com\/ru\/post\/539488\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-317056","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=317056"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317056\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=317056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=317056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=317056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}