This commit is contained in:
Saifeddine ALOUI 2025-03-28 22:15:39 +01:00
parent 8a5a585954
commit e7bad4a3c3
3 changed files with 26 additions and 21 deletions

View File

@ -656,7 +656,7 @@ class LollmsApplication(LoLLMsCom):
if self.config.active_ttm_service:
def start_ttm(*args, **kwargs):
self.ttv = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttv", self.config.active_ttm_service)
self.ttv = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttm", self.config.active_ttm_service)
ASCIIColors.execute_with_animation("Loading loacal TTM services", start_ttm, ASCIIColors.color_blue)
print("OK")
@ -690,26 +690,31 @@ class LollmsApplication(LoLLMsCom):
trace_exception(ex)
self.warning(f"Couldn't load vllm")
def start_tti(*args, **kwargs):
self.tti = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"tti", self.config.active_tti_service)
ASCIIColors.execute_with_animation("Loading loacal TTI services", start_tti, ASCIIColors.color_blue)
if self.config.active_tti_service:
def start_tti(*args, **kwargs):
self.tti = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"tti", self.config.active_tti_service)
ASCIIColors.execute_with_animation("Loading loacal TTI services", start_tti, ASCIIColors.color_blue)
def start_stt(*args, **kwargs):
self.stt = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"stt", self.config.active_stt_service)
ASCIIColors.execute_with_animation("Loading loacal STT services", start_stt, ASCIIColors.color_blue)
if self.config.active_stt_service:
def start_stt(*args, **kwargs):
self.stt = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"stt", self.config.active_stt_service)
ASCIIColors.execute_with_animation("Loading loacal STT services", start_stt, ASCIIColors.color_blue)
def start_tts(*args, **kwargs):
self.tts = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"tts", self.config.active_tts_service)
ASCIIColors.execute_with_animation("Loading loacal STT services", start_tts, ASCIIColors.color_blue)
if self.config.active_tts_service:
def start_tts(*args, **kwargs):
self.tts = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"tts", self.config.active_tts_service)
ASCIIColors.execute_with_animation("Loading loacal STT services", start_tts, ASCIIColors.color_blue)
if self.config.active_ttm_service:
def start_ttm(*args, **kwargs):
self.ttv = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttm", self.config.active_ttm_service)
ASCIIColors.execute_with_animation("Loading loacal TTM services", start_ttm, ASCIIColors.color_blue)
def start_ttv(*args, **kwargs):
self.ttv = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttv", self.config.active_ttv_service)
ASCIIColors.execute_with_animation("Loading loacal TTV services", start_ttv, ASCIIColors.color_blue)
if self.config.active_ttv_service:
def start_ttv(*args, **kwargs):
self.ttv = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttv", self.config.active_ttv_service)
ASCIIColors.execute_with_animation("Loading loacal TTV services", start_ttv, ASCIIColors.color_blue)
print("OK")

View File

View File

@ -12,6 +12,9 @@ from pathlib import Path
from typing import List, Dict
from lollms.ttm import LollmsTTM
from lollms.utilities import PackageManager, File_Path_Generator, check_and_install_torch
import pipmaster as pm
pm.install_if_missing("audiocraft")
from audiocraft.models import musicgen
class LollmsMusicGen(LollmsTTM):
"""
@ -49,16 +52,13 @@ class LollmsMusicGen(LollmsTTM):
self.model = model
self.api_key = api_key
self.output_path = output_path
if not PackageManager.check_package_installed("musicgen"):
check_and_install_torch(True if device=="cuda" else False)
PackageManager.install_or_update("musicgen")
from audiocraft.models import musicgen
self.music_model = musicgen.MusicGen.get_pretrained(model, device=device)
self.models = [] # To be filled by the child class
self.ready = True
def settings_updated(self):
pass
def generate(self,
positive_prompt: str,
negative_prompt: str = "",