diff --git a/lollms/app.py b/lollms/app.py index ac4433b..e8fb47d 100644 --- a/lollms/app.py +++ b/lollms/app.py @@ -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") diff --git a/lollms/services/ttm/musicgen/config.yaml b/lollms/services/ttm/musicgen/config.yaml new file mode 100644 index 0000000..e69de29 diff --git a/lollms/services/ttm/musicgen/lollms_musicgen.py b/lollms/services/ttm/musicgen/service.py similarity index 95% rename from lollms/services/ttm/musicgen/lollms_musicgen.py rename to lollms/services/ttm/musicgen/service.py index 044da35..002bbc1 100644 --- a/lollms/services/ttm/musicgen/lollms_musicgen.py +++ b/lollms/services/ttm/musicgen/service.py @@ -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 = "",