bugfix
This commit is contained in:
parent
3d4f10a732
commit
e30565e92e
14
app/asr.py
14
app/asr.py
@ -2,17 +2,23 @@ from ahserver.webapp import webapp
|
||||
from ahserver.serverenv import ServerEnv
|
||||
from ahserver.filestorage import FileStorage
|
||||
from appPublic.log import debug,exception, error
|
||||
from appPublic.worker import awiatify
|
||||
from appPublic.worker import awaitify
|
||||
from appPublic.jsonConfig import getConfig
|
||||
import torch
|
||||
import nemo.collections.asr as nemo_asr
|
||||
|
||||
claas NvidiaASR:
|
||||
class NVidiaASR:
|
||||
def __init__(self):
|
||||
config = getConfig()
|
||||
self.models = {}
|
||||
device = torch.device(config.device)
|
||||
for lang, model_path in config.asr_models:
|
||||
model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(model_path)
|
||||
for lang, model_path in config.asr_models.items():
|
||||
debug(f'{lang=}, {model_path=}')
|
||||
model = None
|
||||
if lang == 'en':
|
||||
model = nemo_asr.models.EncDecCTCModelBPE.restore_from(model_path)
|
||||
elif lang == 'cn':
|
||||
model = nemo_asr.models.EncDecCTCModel.restore_from(model_path)
|
||||
model.to(device)
|
||||
self.models[lang] = model
|
||||
|
||||
|
@ -1,3 +1,50 @@
|
||||
parakeet-tdt-0.6b-v2
|
||||
stt_en_conformer_ctc_large
|
||||
stt_zh_citrinet_1024_gamma_0_25
|
||||
{
|
||||
"device" : "cuda",
|
||||
"asr_models":{
|
||||
"cn": "/share/ymq/models/nvidia/stt_zh_citrinet_1024_gamma_0_25/stt_zh_citrinet_1024_gamma_0_25.nemo",
|
||||
"en": "/share/ymq/models/nvidia/stt_en_conformer_ctc_large/stt_en_conformer_ctc_large.nemo"
|
||||
},
|
||||
"logger":{
|
||||
"name":"asr",
|
||||
"levelname":"info",
|
||||
"logfile":"$[workdir]$/logs/asr.log"
|
||||
},
|
||||
"filesroot":"$[workdir]$/files",
|
||||
"website":{
|
||||
"paths":[
|
||||
["$[workdir]$/wwwroot",""]
|
||||
],
|
||||
"client_max_size":10000,
|
||||
"host":"0.0.0.0",
|
||||
"port":9992,
|
||||
"coding":"utf-8",
|
||||
"indexes":[
|
||||
"index.html",
|
||||
"index.tmpl",
|
||||
"index.ui",
|
||||
"index.dspy",
|
||||
"index.md"
|
||||
],
|
||||
"startswiths":[
|
||||
{
|
||||
"leading":"/idfile",
|
||||
"registerfunction":"idfile"
|
||||
}
|
||||
],
|
||||
"processors":[
|
||||
[".dspy","dspy"],
|
||||
[".md","md"]
|
||||
],
|
||||
"session_max_time":3000,
|
||||
"session_issue_time":2500,
|
||||
"session_redis_notuse":{
|
||||
"url":"redis://127.0.0.1:6379"
|
||||
}
|
||||
},
|
||||
"langMapping":{
|
||||
"zh-Hans-CN":"zh-cn",
|
||||
"zh-CN":"zh-cn",
|
||||
"en-us":"en",
|
||||
"en-US":"en"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
wheel
|
||||
typing_extensions
|
||||
numpy
|
||||
nemo-toolkits[asr]
|
||||
nemo-toolkit[asr]
|
||||
|
Loading…
Reference in New Issue
Block a user