bugfix
This commit is contained in:
parent
af4a0810ff
commit
9f57b05801
@ -1,5 +1,9 @@
|
||||
{
|
||||
"filesroot":"$[workdir]$/files",
|
||||
|
||||
"model_path": "/data/ymq/models/openai/whisper-large-v3",
|
||||
"redis_url": "redis://127.0.0.1:6379",
|
||||
"worker_cnt": 1,
|
||||
"logger":{
|
||||
"name":"fastwhisper",
|
||||
"levelname":"info",
|
||||
|
||||
11
fw/fw.py
11
fw/fw.py
@ -1,17 +1,22 @@
|
||||
from longtasks.longtasks import LongTasks
|
||||
from faster_whisper import WhisperModel
|
||||
from appPublic.worker import awaitify
|
||||
from appPublic.jsonConfig import getConfig
|
||||
from ahserver.filestorage import FileStorage
|
||||
|
||||
class MyLongTask(LongTasks):
|
||||
def __init__(self, *args, **kw):
|
||||
super().__init__(self, *args, **kw)
|
||||
def __init__(self):
|
||||
self.config = getConfig()
|
||||
redis_url = self.config.redis_url
|
||||
taskname = 'fastwhisper'
|
||||
worker_cnt = self.config.worker_cnt
|
||||
super().__init__(self, redis_url, taskname, worker_cnt=worker_cnt)
|
||||
self.load_models()
|
||||
|
||||
def load_models(self):
|
||||
self.models = []
|
||||
for i in range(self.worker_cnt):
|
||||
model = WhisperModel(model_size, device="cuda", compute_type="float16")
|
||||
model = WhisperModel(self.config.model_path, device="cuda", compute_type="float16")
|
||||
self.models.append(model)
|
||||
|
||||
async def process_task(self, payload:dict, workerid:int=None):
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
from fastwhisper.fw import MyLongTask
|
||||
from ahserver.serverenv import ServerEnv
|
||||
from appPublic.jsonConfig import getConfig
|
||||
from appPublic.worker import schedule_once
|
||||
|
||||
def load_fastwhisper()
|
||||
config = getConfig()
|
||||
env = ServerEnv()
|
||||
engine = MyLongTask(config.redis_url, 'fastwhisper')
|
||||
engine = MyLongTask()
|
||||
schedule_once(1, engine.run)
|
||||
env.fastwhisper = engine
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user