lollms-client 1.4.1__py3-none-any.whl → 1.7.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lollms_client/__init__.py +1 -1
- lollms_client/llm_bindings/azure_openai/__init__.py +2 -2
- lollms_client/llm_bindings/claude/__init__.py +125 -34
- lollms_client/llm_bindings/gemini/__init__.py +261 -159
- lollms_client/llm_bindings/grok/__init__.py +52 -14
- lollms_client/llm_bindings/groq/__init__.py +2 -2
- lollms_client/llm_bindings/hugging_face_inference_api/__init__.py +2 -2
- lollms_client/llm_bindings/litellm/__init__.py +1 -1
- lollms_client/llm_bindings/llamacpp/__init__.py +18 -11
- lollms_client/llm_bindings/lollms/__init__.py +151 -32
- lollms_client/llm_bindings/lollms_webui/__init__.py +1 -1
- lollms_client/llm_bindings/mistral/__init__.py +2 -2
- lollms_client/llm_bindings/novita_ai/__init__.py +439 -0
- lollms_client/llm_bindings/ollama/__init__.py +309 -93
- lollms_client/llm_bindings/open_router/__init__.py +2 -2
- lollms_client/llm_bindings/openai/__init__.py +148 -29
- lollms_client/llm_bindings/openllm/__init__.py +362 -506
- lollms_client/llm_bindings/openwebui/__init__.py +465 -0
- lollms_client/llm_bindings/perplexity/__init__.py +326 -0
- lollms_client/llm_bindings/pythonllamacpp/__init__.py +3 -3
- lollms_client/llm_bindings/tensor_rt/__init__.py +1 -1
- lollms_client/llm_bindings/transformers/__init__.py +428 -632
- lollms_client/llm_bindings/vllm/__init__.py +1 -1
- lollms_client/lollms_agentic.py +4 -2
- lollms_client/lollms_base_binding.py +61 -0
- lollms_client/lollms_core.py +516 -1890
- lollms_client/lollms_discussion.py +55 -18
- lollms_client/lollms_llm_binding.py +112 -261
- lollms_client/lollms_mcp_binding.py +34 -75
- lollms_client/lollms_personality.py +5 -2
- lollms_client/lollms_stt_binding.py +85 -52
- lollms_client/lollms_tti_binding.py +23 -37
- lollms_client/lollms_ttm_binding.py +24 -42
- lollms_client/lollms_tts_binding.py +28 -17
- lollms_client/lollms_ttv_binding.py +24 -42
- lollms_client/lollms_types.py +4 -2
- lollms_client/stt_bindings/whisper/__init__.py +108 -23
- lollms_client/stt_bindings/whispercpp/__init__.py +7 -1
- lollms_client/tti_bindings/diffusers/__init__.py +418 -810
- lollms_client/tti_bindings/diffusers/server/main.py +1051 -0
- lollms_client/tti_bindings/gemini/__init__.py +182 -239
- lollms_client/tti_bindings/leonardo_ai/__init__.py +127 -0
- lollms_client/tti_bindings/lollms/__init__.py +4 -1
- lollms_client/tti_bindings/novita_ai/__init__.py +105 -0
- lollms_client/tti_bindings/openai/__init__.py +10 -11
- lollms_client/tti_bindings/stability_ai/__init__.py +178 -0
- lollms_client/ttm_bindings/audiocraft/__init__.py +7 -12
- lollms_client/ttm_bindings/beatoven_ai/__init__.py +129 -0
- lollms_client/ttm_bindings/lollms/__init__.py +4 -17
- lollms_client/ttm_bindings/replicate/__init__.py +115 -0
- lollms_client/ttm_bindings/stability_ai/__init__.py +117 -0
- lollms_client/ttm_bindings/topmediai/__init__.py +96 -0
- lollms_client/tts_bindings/bark/__init__.py +7 -10
- lollms_client/tts_bindings/lollms/__init__.py +6 -1
- lollms_client/tts_bindings/piper_tts/__init__.py +8 -11
- lollms_client/tts_bindings/xtts/__init__.py +157 -74
- lollms_client/tts_bindings/xtts/server/main.py +241 -280
- {lollms_client-1.4.1.dist-info → lollms_client-1.7.10.dist-info}/METADATA +316 -6
- lollms_client-1.7.10.dist-info/RECORD +89 -0
- lollms_client/ttm_bindings/bark/__init__.py +0 -339
- lollms_client-1.4.1.dist-info/RECORD +0 -78
- {lollms_client-1.4.1.dist-info → lollms_client-1.7.10.dist-info}/WHEEL +0 -0
- {lollms_client-1.4.1.dist-info → lollms_client-1.7.10.dist-info}/licenses/LICENSE +0 -0
- {lollms_client-1.4.1.dist-info → lollms_client-1.7.10.dist-info}/top_level.txt +0 -0
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
# lollms_client/ttm_bindings/bark/__init__.py
|
|
2
|
-
import io
|
|
3
|
-
import os
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from typing import Optional, List, Union, Dict, Any
|
|
6
|
-
|
|
7
|
-
from ascii_colors import trace_exception, ASCIIColors
|
|
8
|
-
|
|
9
|
-
# --- Package Management and Conditional Imports ---
|
|
10
|
-
_bark_deps_installed_with_correct_torch = False
|
|
11
|
-
_bark_installation_error = ""
|
|
12
|
-
try:
|
|
13
|
-
import pipmaster as pm
|
|
14
|
-
import platform
|
|
15
|
-
|
|
16
|
-
preferred_torch_device_for_install = "cpu"
|
|
17
|
-
if platform.system() == "Linux" or platform.system() == "Windows":
|
|
18
|
-
preferred_torch_device_for_install = "cuda"
|
|
19
|
-
elif platform.system() == "Darwin":
|
|
20
|
-
preferred_torch_device_for_install = "mps"
|
|
21
|
-
|
|
22
|
-
torch_pkgs = ["torch"]
|
|
23
|
-
bark_core_pkgs = ["transformers", "accelerate", "sentencepiece"]
|
|
24
|
-
other_deps = ["scipy", "numpy"]
|
|
25
|
-
|
|
26
|
-
torch_index_url = None
|
|
27
|
-
if preferred_torch_device_for_install == "cuda":
|
|
28
|
-
torch_index_url = "https://download.pytorch.org/whl/cu126"
|
|
29
|
-
ASCIIColors.info(f"Attempting to ensure PyTorch with CUDA support (target index: {torch_index_url}) for Bark binding.")
|
|
30
|
-
pm.ensure_packages(torch_pkgs, index_url=torch_index_url)
|
|
31
|
-
pm.ensure_packages(bark_core_pkgs + other_deps)
|
|
32
|
-
else:
|
|
33
|
-
ASCIIColors.info("Ensuring PyTorch, Bark dependencies, and others using default PyPI index for Bark binding.")
|
|
34
|
-
pm.ensure_packages(torch_pkgs + bark_core_pkgs + other_deps)
|
|
35
|
-
|
|
36
|
-
import torch
|
|
37
|
-
from transformers import AutoProcessor, BarkModel, GenerationConfig
|
|
38
|
-
import scipy.io.wavfile
|
|
39
|
-
import numpy as np
|
|
40
|
-
|
|
41
|
-
_bark_deps_installed_with_correct_torch = True
|
|
42
|
-
except Exception as e:
|
|
43
|
-
_bark_installation_error = str(e)
|
|
44
|
-
AutoProcessor, BarkModel, GenerationConfig, torch, scipy, np = None, None, None, None, None, None
|
|
45
|
-
# --- End Package Management ---
|
|
46
|
-
|
|
47
|
-
from lollms_client.lollms_ttm_binding import LollmsTTMBinding
|
|
48
|
-
|
|
49
|
-
BindingName = "BarkTTMBinding"
|
|
50
|
-
|
|
51
|
-
DEFAULT_BARK_MODELS = [
|
|
52
|
-
"suno/bark",
|
|
53
|
-
"suno/bark-small",
|
|
54
|
-
]
|
|
55
|
-
|
|
56
|
-
BARK_VOICE_PRESETS_EXAMPLES = [
|
|
57
|
-
"v2/en_speaker_0", "v2/en_speaker_1", "v2/en_speaker_2", "v2/en_speaker_3",
|
|
58
|
-
"v2/en_speaker_4", "v2/en_speaker_5", "v2/en_speaker_6", "v2/en_speaker_7",
|
|
59
|
-
"v2/en_speaker_8", "v2/en_speaker_9",
|
|
60
|
-
"v2/de_speaker_0", "v2/es_speaker_0", "v2/fr_speaker_0",
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
class BarkTTMBinding(LollmsTTMBinding):
|
|
65
|
-
def __init__(self,
|
|
66
|
-
model_name: str = "suno/bark-small",
|
|
67
|
-
device: Optional[str] = None,
|
|
68
|
-
default_voice_preset: Optional[str] = "v2/en_speaker_6",
|
|
69
|
-
enable_better_transformer: bool = True,
|
|
70
|
-
**kwargs):
|
|
71
|
-
|
|
72
|
-
super().__init__(binding_name="bark")
|
|
73
|
-
|
|
74
|
-
if not _bark_deps_installed_with_correct_torch:
|
|
75
|
-
raise ImportError(f"Bark TTM binding dependencies not met. Error: {_bark_installation_error}")
|
|
76
|
-
|
|
77
|
-
self.device = device
|
|
78
|
-
if self.device is None:
|
|
79
|
-
if torch.cuda.is_available(): self.device = "cuda"; ASCIIColors.info("CUDA device detected by PyTorch for Bark.")
|
|
80
|
-
elif hasattr(torch.backends, 'mps') and torch.backends.mps.is_available(): self.device = "mps"; ASCIIColors.info("MPS device detected for Bark.")
|
|
81
|
-
else: self.device = "cpu"; ASCIIColors.info("No GPU (CUDA/MPS) by PyTorch, using CPU for Bark.")
|
|
82
|
-
elif self.device == "cuda" and not torch.cuda.is_available(): self.device = "cpu"; ASCIIColors.warning("CUDA req, not avail. CPU for Bark.")
|
|
83
|
-
elif self.device == "mps" and not (hasattr(torch.backends, 'mps') and torch.backends.mps.is_available()): self.device = "cpu"; ASCIIColors.warning("MPS req, not avail. CPU for Bark.")
|
|
84
|
-
|
|
85
|
-
ASCIIColors.info(f"BarkTTMBinding: Using device '{self.device}'.")
|
|
86
|
-
|
|
87
|
-
self.loaded_model_name = None
|
|
88
|
-
self.model: Optional[BarkModel] = None
|
|
89
|
-
self.processor: Optional[AutoProcessor] = None
|
|
90
|
-
self.default_voice_preset = default_voice_preset
|
|
91
|
-
self.enable_better_transformer = enable_better_transformer
|
|
92
|
-
|
|
93
|
-
self.default_generation_params = {}
|
|
94
|
-
temp_gen_config = GenerationConfig()
|
|
95
|
-
for key, value in kwargs.items():
|
|
96
|
-
if hasattr(temp_gen_config, key):
|
|
97
|
-
self.default_generation_params[key] = value
|
|
98
|
-
|
|
99
|
-
self._load_bark_model(model_name)
|
|
100
|
-
|
|
101
|
-
def _load_bark_model(self, model_name_to_load: str):
|
|
102
|
-
if self.model is not None and self.loaded_model_name == model_name_to_load:
|
|
103
|
-
ASCIIColors.info(f"Bark model '{model_name_to_load}' already loaded.")
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
ASCIIColors.info(f"Loading Bark model: '{model_name_to_load}' on device '{self.device}'...")
|
|
107
|
-
try:
|
|
108
|
-
dtype_for_bark = torch.float16 if self.device == "cuda" else None
|
|
109
|
-
|
|
110
|
-
self.processor = AutoProcessor.from_pretrained(model_name_to_load)
|
|
111
|
-
self.model = BarkModel.from_pretrained(
|
|
112
|
-
model_name_to_load,
|
|
113
|
-
torch_dtype=dtype_for_bark,
|
|
114
|
-
low_cpu_mem_usage=True if self.device != "cpu" else False
|
|
115
|
-
).to(self.device)
|
|
116
|
-
|
|
117
|
-
if self.enable_better_transformer and self.device == "cuda":
|
|
118
|
-
try:
|
|
119
|
-
self.model = self.model.to_bettertransformer()
|
|
120
|
-
ASCIIColors.info("Applied BetterTransformer optimization to Bark model.")
|
|
121
|
-
except Exception as e_bt:
|
|
122
|
-
ASCIIColors.warning(f"Failed to apply BetterTransformer: {e_bt}. Proceeding without it.")
|
|
123
|
-
|
|
124
|
-
if "small" not in model_name_to_load and self.device=="cpu":
|
|
125
|
-
ASCIIColors.warning("Using full Bark model on CPU. Generation might be slow.")
|
|
126
|
-
elif self.device != "cpu" and "small" not in model_name_to_load:
|
|
127
|
-
if hasattr(self.model, "enable_model_cpu_offload"):
|
|
128
|
-
try: self.model.enable_model_cpu_offload(); ASCIIColors.info("Enabled model_cpu_offload for Bark.")
|
|
129
|
-
except Exception as e: ASCIIColors.warning(f"Could not enable model_cpu_offload: {e}")
|
|
130
|
-
elif hasattr(self.model, "enable_cpu_offload"):
|
|
131
|
-
try: self.model.enable_cpu_offload(); ASCIIColors.info("Enabled cpu_offload for Bark (older API).")
|
|
132
|
-
except Exception as e: ASCIIColors.warning(f"Could not enable cpu_offload (older API): {e}")
|
|
133
|
-
else: ASCIIColors.info("CPU offload not explicitly enabled.")
|
|
134
|
-
|
|
135
|
-
self.loaded_model_name = model_name_to_load
|
|
136
|
-
ASCIIColors.green(f"Bark model '{model_name_to_load}' loaded successfully.")
|
|
137
|
-
except Exception as e:
|
|
138
|
-
self.model, self.processor, self.loaded_model_name = None, None, None
|
|
139
|
-
ASCIIColors.error(f"Failed to load Bark model '{model_name_to_load}': {e}"); trace_exception(e)
|
|
140
|
-
raise RuntimeError(f"Failed to load Bark model '{model_name_to_load}'") from e
|
|
141
|
-
|
|
142
|
-
def generate_music(self,
|
|
143
|
-
prompt: str,
|
|
144
|
-
voice_preset: Optional[str] = None,
|
|
145
|
-
do_sample: Optional[bool] = None,
|
|
146
|
-
temperature: Optional[float] = None,
|
|
147
|
-
**kwargs) -> bytes:
|
|
148
|
-
if self.model is None or self.processor is None:
|
|
149
|
-
raise RuntimeError("Bark model or processor not loaded.")
|
|
150
|
-
|
|
151
|
-
effective_voice_preset = voice_preset if voice_preset is not None else self.default_voice_preset
|
|
152
|
-
|
|
153
|
-
ASCIIColors.info(f"Generating SFX/audio with Bark: '{prompt[:60]}...' (Preset: {effective_voice_preset})")
|
|
154
|
-
try:
|
|
155
|
-
# The processor correctly returns 'input_ids' and 'attention_mask'
|
|
156
|
-
inputs = self.processor(
|
|
157
|
-
text=[prompt], # Processor expects a list of texts
|
|
158
|
-
voice_preset=effective_voice_preset,
|
|
159
|
-
return_tensors="pt",
|
|
160
|
-
# Explicitly ask for padding if tokenizer supports it,
|
|
161
|
-
# though Bark's processor might handle this internally.
|
|
162
|
-
# padding=True, # Let processor decide best padding strategy
|
|
163
|
-
# truncation=True # Ensure inputs fit model context
|
|
164
|
-
)
|
|
165
|
-
inputs = {k: v.to(self.device) for k, v in inputs.items()}
|
|
166
|
-
|
|
167
|
-
# Ensure attention_mask is present
|
|
168
|
-
if 'attention_mask' not in inputs:
|
|
169
|
-
ASCIIColors.warning("Processor did not return attention_mask. Creating a default one (all ones). This might lead to suboptimal results if padding was intended.")
|
|
170
|
-
inputs['attention_mask'] = torch.ones_like(inputs['input_ids'])
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if hasattr(self.model, 'generation_config') and self.model.generation_config is not None:
|
|
174
|
-
gen_config = GenerationConfig.from_dict(self.model.generation_config.to_dict())
|
|
175
|
-
else:
|
|
176
|
-
gen_config = GenerationConfig()
|
|
177
|
-
|
|
178
|
-
for key, value in self.default_generation_params.items():
|
|
179
|
-
if hasattr(gen_config, key): setattr(gen_config, key, value)
|
|
180
|
-
|
|
181
|
-
if do_sample is not None: gen_config.do_sample = do_sample
|
|
182
|
-
|
|
183
|
-
if temperature is not None:
|
|
184
|
-
if 'semantic_temperature' not in kwargs and hasattr(gen_config, 'semantic_temperature'): gen_config.semantic_temperature = temperature
|
|
185
|
-
if 'coarse_temperature' not in kwargs and hasattr(gen_config, 'coarse_temperature'): gen_config.coarse_temperature = temperature
|
|
186
|
-
if 'fine_temperature' not in kwargs and hasattr(gen_config, 'fine_temperature'): gen_config.fine_temperature = temperature
|
|
187
|
-
|
|
188
|
-
for key, value in kwargs.items():
|
|
189
|
-
if hasattr(gen_config, key): setattr(gen_config, key, value)
|
|
190
|
-
|
|
191
|
-
# Critical: Set pad_token_id in GenerationConfig.
|
|
192
|
-
# Bark uses specific token IDs for its different codebooks.
|
|
193
|
-
# The processor's tokenizer should have the correct pad_token_id if it's used for text inputs.
|
|
194
|
-
# For Bark, the semantic vocabulary has its own pad_token_id, often same as EOS.
|
|
195
|
-
# Let's try to get it from the model's semantic config or text config.
|
|
196
|
-
pad_token_id_to_set = None
|
|
197
|
-
if hasattr(self.model.config, 'semantic_config') and hasattr(self.model.config.semantic_config, 'pad_token_id'):
|
|
198
|
-
pad_token_id_to_set = self.model.config.semantic_config.pad_token_id
|
|
199
|
-
elif hasattr(self.model.config, 'text_config') and hasattr(self.model.config.text_config, 'pad_token_id'):
|
|
200
|
-
pad_token_id_to_set = self.model.config.text_config.pad_token_id
|
|
201
|
-
elif hasattr(self.processor, 'tokenizer') and self.processor.tokenizer and self.processor.tokenizer.pad_token_id is not None:
|
|
202
|
-
pad_token_id_to_set = self.processor.tokenizer.pad_token_id
|
|
203
|
-
|
|
204
|
-
if pad_token_id_to_set is not None:
|
|
205
|
-
gen_config.pad_token_id = pad_token_id_to_set
|
|
206
|
-
# Also set EOS token if it's distinct and meaningful for generation stopping
|
|
207
|
-
if hasattr(gen_config, 'eos_token_id') and gen_config.eos_token_id is None:
|
|
208
|
-
eos_id = None
|
|
209
|
-
if hasattr(self.model.config, 'semantic_config') and hasattr(self.model.config.semantic_config, 'eos_token_id'):
|
|
210
|
-
eos_id = self.model.config.semantic_config.eos_token_id
|
|
211
|
-
if eos_id is not None:
|
|
212
|
-
gen_config.eos_token_id = eos_id
|
|
213
|
-
|
|
214
|
-
else:
|
|
215
|
-
# This state is problematic for Bark if pad_token_id is truly needed and distinct from EOS
|
|
216
|
-
ASCIIColors.warning("Could not determine a specific pad_token_id from Bark's config for GenerationConfig. This might lead to issues.")
|
|
217
|
-
# If eos_token_id is also not set, generation might not stop correctly.
|
|
218
|
-
# Defaulting pad_token_id to eos_token_id if eos_token_id exists.
|
|
219
|
-
if gen_config.eos_token_id is not None:
|
|
220
|
-
gen_config.pad_token_id = gen_config.eos_token_id
|
|
221
|
-
ASCIIColors.info(f"Setting pad_token_id to eos_token_id ({gen_config.eos_token_id}) as a fallback.")
|
|
222
|
-
else:
|
|
223
|
-
# This is a last resort and might not be correct for Bark specifically
|
|
224
|
-
gen_config.pad_token_id = 0
|
|
225
|
-
ASCIIColors.warning("pad_token_id defaulted to 0 as a last resort.")
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
ASCIIColors.debug(f"Bark final generation_config: {gen_config.to_json_string()}")
|
|
229
|
-
|
|
230
|
-
with torch.no_grad():
|
|
231
|
-
output = self.model.generate(
|
|
232
|
-
input_ids=inputs['input_ids'], # Explicitly pass input_ids
|
|
233
|
-
attention_mask=inputs.get('attention_mask'), # Pass attention_mask if available
|
|
234
|
-
generation_config=gen_config
|
|
235
|
-
)
|
|
236
|
-
|
|
237
|
-
if isinstance(output, torch.Tensor): speech_output_tensor = output
|
|
238
|
-
elif isinstance(output, dict) and "audio_features" in output: speech_output_tensor = output["audio_features"]
|
|
239
|
-
elif isinstance(output, dict) and "waveform" in output: speech_output_tensor = output["waveform"] # Bark might return this key
|
|
240
|
-
else: raise TypeError(f"Unexpected output type from BarkModel.generate: {type(output)}. Content: {output}")
|
|
241
|
-
|
|
242
|
-
audio_array_np = speech_output_tensor.cpu().numpy().squeeze()
|
|
243
|
-
if audio_array_np.ndim == 0 or audio_array_np.size == 0:
|
|
244
|
-
raise RuntimeError("Bark model returned empty audio data.")
|
|
245
|
-
|
|
246
|
-
audio_int16 = (audio_array_np * 32767).astype(np.int16)
|
|
247
|
-
|
|
248
|
-
buffer = io.BytesIO()
|
|
249
|
-
sample_rate_to_use = int(self.model.generation_config.sample_rate if hasattr(self.model.generation_config, 'sample_rate') and self.model.generation_config.sample_rate else 24_000)
|
|
250
|
-
scipy.io.wavfile.write(buffer, rate=sample_rate_to_use, data=audio_int16)
|
|
251
|
-
audio_bytes = buffer.getvalue()
|
|
252
|
-
buffer.close()
|
|
253
|
-
|
|
254
|
-
ASCIIColors.green("Bark audio generation successful.")
|
|
255
|
-
return audio_bytes
|
|
256
|
-
except Exception as e:
|
|
257
|
-
ASCIIColors.error(f"Bark audio generation failed: {e}"); trace_exception(e)
|
|
258
|
-
if "out of memory" in str(e).lower() and self.device == "cuda":
|
|
259
|
-
ASCIIColors.yellow("CUDA out of memory. Consider using suno/bark-small or ensure GPU has sufficient VRAM.")
|
|
260
|
-
raise RuntimeError(f"Bark audio generation error: {e}") from e
|
|
261
|
-
|
|
262
|
-
def list_models(self, **kwargs) -> List[str]:
|
|
263
|
-
return DEFAULT_BARK_MODELS.copy()
|
|
264
|
-
|
|
265
|
-
def list_voice_presets(self) -> List[str]:
|
|
266
|
-
return BARK_VOICE_PRESETS_EXAMPLES.copy()
|
|
267
|
-
|
|
268
|
-
def __del__(self):
|
|
269
|
-
if hasattr(self, 'model') and self.model is not None:
|
|
270
|
-
del self.model; self.model = None
|
|
271
|
-
if hasattr(self, 'processor') and self.processor is not None:
|
|
272
|
-
del self.processor; self.processor = None
|
|
273
|
-
if torch and hasattr(torch, 'cuda') and torch.cuda.is_available():
|
|
274
|
-
torch.cuda.empty_cache()
|
|
275
|
-
loaded_name = getattr(self, 'loaded_model_name', None)
|
|
276
|
-
msg = f"BarkTTMBinding for model '{loaded_name}' destroyed." if loaded_name else "BarkTTMBinding destroyed."
|
|
277
|
-
ASCIIColors.info(msg)
|
|
278
|
-
|
|
279
|
-
# --- Main Test Block ---
|
|
280
|
-
if __name__ == '__main__':
|
|
281
|
-
if not _bark_deps_installed_with_correct_torch:
|
|
282
|
-
print(f"{ASCIIColors.RED}Bark TTM binding dependencies not met. Skipping tests. Error: {_bark_installation_error}{ASCIIColors.RESET}")
|
|
283
|
-
exit()
|
|
284
|
-
|
|
285
|
-
ASCIIColors.yellow("--- BarkTTMBinding Test ---")
|
|
286
|
-
test_model_id = "suno/bark-small"
|
|
287
|
-
test_output_dir = Path("./test_bark_sfx_output")
|
|
288
|
-
test_output_dir.mkdir(exist_ok=True)
|
|
289
|
-
ttm_binding = None
|
|
290
|
-
|
|
291
|
-
try:
|
|
292
|
-
ASCIIColors.cyan(f"\n--- Initializing BarkTTMBinding (model: '{test_model_id}') ---")
|
|
293
|
-
ttm_binding = BarkTTMBinding(model_name=test_model_id)
|
|
294
|
-
|
|
295
|
-
ASCIIColors.cyan("\n--- Listing common Bark models ---")
|
|
296
|
-
models = ttm_binding.list_models(); print(f"Common Bark models: {models}")
|
|
297
|
-
ASCIIColors.cyan("\n--- Listing example Bark voice presets ---")
|
|
298
|
-
presets = ttm_binding.list_voice_presets(); print(f"Example presets: {presets[:5]}...")
|
|
299
|
-
|
|
300
|
-
sfx_prompts_to_test = [
|
|
301
|
-
("laser_blast", "A short, sharp laser blast sound effect [SFX]"),
|
|
302
|
-
("footsteps_gravel", "Footsteps walking on gravel [footsteps]."),
|
|
303
|
-
("explosion_distant", "A distant explosion [boom] with a slight echo."),
|
|
304
|
-
("interface_click", "A clean, quick digital interface click sound. [click]"),
|
|
305
|
-
("creature_roar_short", "[roar] A short, guttural creature roar."),
|
|
306
|
-
("ambient_wind", "[wind] Gentle wind blowing through trees."),
|
|
307
|
-
("speech_hello", "Hello, this is a test of Bark's speech capabilities."),
|
|
308
|
-
]
|
|
309
|
-
|
|
310
|
-
for name, prompt in sfx_prompts_to_test:
|
|
311
|
-
ASCIIColors.cyan(f"\n--- Generating SFX/Audio for: '{name}' ---"); print(f"Prompt: {prompt}")
|
|
312
|
-
try:
|
|
313
|
-
call_kwargs = {}
|
|
314
|
-
if "speech" in name:
|
|
315
|
-
call_kwargs = {"semantic_temperature": 0.6, "coarse_temperature": 0.8, "fine_temperature": 0.5, "do_sample": True}
|
|
316
|
-
elif name == "laser_blast":
|
|
317
|
-
call_kwargs = {"semantic_temperature": 0.5, "coarse_temperature": 0.6, "fine_temperature": 0.4, "do_sample": True}
|
|
318
|
-
else: # For SFX, sometimes more deterministic sampling helps for consistency
|
|
319
|
-
call_kwargs = {"do_sample": True, "semantic_temperature": 0.7, "coarse_temperature": 0.7, "fine_temperature": 0.7}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
sfx_bytes = ttm_binding.generate_music(prompt, voice_preset=None, **call_kwargs)
|
|
323
|
-
if sfx_bytes:
|
|
324
|
-
output_filename = f"sfx_{name}_{test_model_id.split('/')[-1]}.wav"
|
|
325
|
-
output_path = test_output_dir / output_filename
|
|
326
|
-
with open(output_path, "wb") as f: f.write(sfx_bytes)
|
|
327
|
-
ASCIIColors.green(f"SFX for '{name}' saved to: {output_path} ({len(sfx_bytes) / 1024:.2f} KB)")
|
|
328
|
-
else: ASCIIColors.error(f"SFX generation for '{name}' returned empty bytes.")
|
|
329
|
-
except Exception as e_gen: ASCIIColors.error(f"Failed to generate SFX for '{name}': {e_gen}")
|
|
330
|
-
|
|
331
|
-
except ImportError as e_imp: ASCIIColors.error(f"Import error: {e_imp}")
|
|
332
|
-
except RuntimeError as e_rt: ASCIIColors.error(f"Runtime error: {e_rt}")
|
|
333
|
-
except Exception as e: ASCIIColors.error(f"Unexpected error: {e}"); trace_exception(e)
|
|
334
|
-
finally:
|
|
335
|
-
if ttm_binding: del ttm_binding
|
|
336
|
-
ASCIIColors.info(f"Test SFX (if any) are in: {test_output_dir.resolve()}")
|
|
337
|
-
print(f"{ASCIIColors.YELLOW}Check the audio files in '{test_output_dir.resolve()}'!{ASCIIColors.RESET}")
|
|
338
|
-
|
|
339
|
-
ASCIIColors.yellow("\n--- BarkTTMBinding Test Finished ---")
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
lollms_client/__init__.py,sha256=G2ENRPwIlHb_nTaBEbn_AvUQvlsBYpIuQXGWYkYmyo0,1146
|
|
2
|
-
lollms_client/lollms_agentic.py,sha256=pQiMEuB_XkG29-SW6u4KTaMFPr6eKqacInggcCuCW3k,13914
|
|
3
|
-
lollms_client/lollms_config.py,sha256=goEseDwDxYJf3WkYJ4IrLXwg3Tfw73CXV2Avg45M_hE,21876
|
|
4
|
-
lollms_client/lollms_core.py,sha256=aCEoxmEF6ZmkBgJgZd74lKkM4A3PVVyt2IwMvLfScWw,315053
|
|
5
|
-
lollms_client/lollms_discussion.py,sha256=jWw1lSq0Oz_X5pnkECf1XwdDP2Lf84im00VpwuvsXXk,123041
|
|
6
|
-
lollms_client/lollms_js_analyzer.py,sha256=01zUvuO2F_lnUe_0NLxe1MF5aHE1hO8RZi48mNPv-aw,8361
|
|
7
|
-
lollms_client/lollms_llm_binding.py,sha256=Dj1PI2bQBYv_JgPxCIaIC7DMUvWdFJGwXFdsP5hdGBg,25014
|
|
8
|
-
lollms_client/lollms_mcp_binding.py,sha256=psb27A23VFWDfZsR2WUbQXQxiZDW5yfOak6ZtbMfszI,10222
|
|
9
|
-
lollms_client/lollms_mcp_security.py,sha256=FhVTDhSBjksGEZnopVnjFmEF5dv7D8bBTqoaj4BiF0E,3562
|
|
10
|
-
lollms_client/lollms_personality.py,sha256=O-9nqZhazcITOkxjT24ENTxTmIoZLgqIsQ9WtWs0Id0,8719
|
|
11
|
-
lollms_client/lollms_python_analyzer.py,sha256=7gf1fdYgXCOkPUkBAPNmr6S-66hMH4_KonOMsADASxc,10246
|
|
12
|
-
lollms_client/lollms_stt_binding.py,sha256=jAUhLouEhh2hmm1bK76ianfw_6B59EHfY3FmLv6DU-g,5111
|
|
13
|
-
lollms_client/lollms_tti_binding.py,sha256=B38nzBCSPV9jVRZa-x8W7l9nJEW0RyS1MMJoueb8kt0,8519
|
|
14
|
-
lollms_client/lollms_ttm_binding.py,sha256=FjVVSNXOZXK1qvcKEfxdiX6l2b4XdGOSNnZ0utAsbDg,4167
|
|
15
|
-
lollms_client/lollms_tts_binding.py,sha256=4qw94lc9M8lsh2q1u3FF0RuxTY__kukYg266ai3or-Y,5126
|
|
16
|
-
lollms_client/lollms_ttv_binding.py,sha256=KkTaHLBhEEdt4sSVBlbwr5i_g_TlhcrwrT-7DjOsjWQ,4131
|
|
17
|
-
lollms_client/lollms_types.py,sha256=0iSH1QHRRD-ddBqoL9EEKJ8wWCuwDUlN_FrfbCdg7Lw,3522
|
|
18
|
-
lollms_client/lollms_utilities.py,sha256=3DAsII2X9uhRzRL-D0QlALcEdRg82y7OIL4yHVF32gY,19446
|
|
19
|
-
lollms_client/assets/models_ctx_sizes.json,sha256=jFDLW4GoT431544QXXyi9fA5tqIBmTrwaIA1_syoZ-Y,14972
|
|
20
|
-
lollms_client/llm_bindings/__init__.py,sha256=9sWGpmWSSj6KQ8H4lKGCjpLYwhnVdL_2N7gXCphPqh4,14
|
|
21
|
-
lollms_client/llm_bindings/azure_openai/__init__.py,sha256=XBDwct0nkvWfpo1J9J9lTOszH_c_4IiCYxEsG6aJLo0,16501
|
|
22
|
-
lollms_client/llm_bindings/claude/__init__.py,sha256=tzt9sR-9WlkgTgDBOtV708ZmuBjMm55fEYhurMnfXO4,24669
|
|
23
|
-
lollms_client/llm_bindings/gemini/__init__.py,sha256=bMzjVo_LU5uC493q4DVjq-WVotzgTZN1T_w0Qqv5aDg,21386
|
|
24
|
-
lollms_client/llm_bindings/grok/__init__.py,sha256=tVIIl2uXpBYD7ia3k8JqYM8uvAVYlp-mtG-8D3LFVS8,22929
|
|
25
|
-
lollms_client/llm_bindings/groq/__init__.py,sha256=EGrMh9vuCoM4pskDw8ydfsAWYgEb423e9HBwqdO2JQc,12120
|
|
26
|
-
lollms_client/llm_bindings/hugging_face_inference_api/__init__.py,sha256=SFcj5XQTDmN9eR4of82IgQa9iRYZaGlF6rMlF5S5wWg,13938
|
|
27
|
-
lollms_client/llm_bindings/litellm/__init__.py,sha256=lRH4VfZMUG5JCCj6a7hk2PTfSyDowAu-ujLOM-XPl-8,12756
|
|
28
|
-
lollms_client/llm_bindings/llamacpp/__init__.py,sha256=llPF85AzYgMp7Cpo_4OvEHKlxIAgI6F95NB3SqskD9E,62480
|
|
29
|
-
lollms_client/llm_bindings/lollms/__init__.py,sha256=XFQKtTJnkW8OwF1IoyzHqAZ8JAJ0PnAUKDdeOLGcbrE,24310
|
|
30
|
-
lollms_client/llm_bindings/lollms_webui/__init__.py,sha256=iuDfhZZoLC-PDEPLHrcjk5-962S5c7OeCI7PMdJxI_A,17753
|
|
31
|
-
lollms_client/llm_bindings/mistral/__init__.py,sha256=cddz9xIj8NRFLKHe2JMxzstpUrNIu5s9juci3mhiHfo,14133
|
|
32
|
-
lollms_client/llm_bindings/ollama/__init__.py,sha256=a6cgzXPuo8ZLhIZHJFy8QF0n5ZTk0X4OC1JSyXG1enk,46013
|
|
33
|
-
lollms_client/llm_bindings/open_router/__init__.py,sha256=cAFWtCWJx0WjIe1w2JReCf6WlAZjrXYA4jZ8l3zqxMs,14915
|
|
34
|
-
lollms_client/llm_bindings/openai/__init__.py,sha256=ElLbtHLwR61Uj3W6G4g6QIhxtCqUGOCQBYwhQyN60us,26142
|
|
35
|
-
lollms_client/llm_bindings/openllm/__init__.py,sha256=RC9dVeopslS-zXTsSJ7VC4iVsKgZCBwfmccmr_LCHA0,29971
|
|
36
|
-
lollms_client/llm_bindings/pythonllamacpp/__init__.py,sha256=ZTuVa5ngu9GPVImjs_g8ArV7Bx7a1Rze518Tz8AFJ3U,31807
|
|
37
|
-
lollms_client/llm_bindings/tensor_rt/__init__.py,sha256=xiT-JAyNI_jo6CE0nle9Xoc7U8-UHAfEHrnCwmDTiOE,32023
|
|
38
|
-
lollms_client/llm_bindings/transformers/__init__.py,sha256=hEonNvmrVSc9YWg_1uVwxe31rC-fsjVGh6QvyBc0TEE,37598
|
|
39
|
-
lollms_client/llm_bindings/vllm/__init__.py,sha256=pZGzCuBos1dzkbqfkAnSAIC2XUX-2BT25c15Yeh8Nwo,32721
|
|
40
|
-
lollms_client/mcp_bindings/local_mcp/__init__.py,sha256=S_hEilM3WLt0u2uluhuJXMNAzTAnWC8FWteBP92V_2g,14336
|
|
41
|
-
lollms_client/mcp_bindings/local_mcp/default_tools/file_writer/file_writer.py,sha256=2pkt1JcEKj61lIA5zuW3s6qkdpQN5rKfooo7bnebx24,3061
|
|
42
|
-
lollms_client/mcp_bindings/local_mcp/default_tools/generate_image_from_prompt/generate_image_from_prompt.py,sha256=THtZsMxNnXZiBdkwoBlfbWY2C5hhDdmPtnM-8cSKN6s,9488
|
|
43
|
-
lollms_client/mcp_bindings/local_mcp/default_tools/internet_search/internet_search.py,sha256=PLC31-D04QKTOTb1uuCHnrAlpysQjsk89yIJngK0VGc,4586
|
|
44
|
-
lollms_client/mcp_bindings/local_mcp/default_tools/python_interpreter/python_interpreter.py,sha256=McDCBVoVrMDYgU7EYtyOY7mCk1uEeTea0PSD69QqDsQ,6228
|
|
45
|
-
lollms_client/mcp_bindings/remote_mcp/__init__.py,sha256=YpSclbNJDYVUe2W0H5Xki4gs_qqAqE95uCl_RYZsxPA,20406
|
|
46
|
-
lollms_client/mcp_bindings/standard_mcp/__init__.py,sha256=wJQofr4zS5RIS9V5_WuMMFsJxSDJgXDW3PQPX1hlx6g,31519
|
|
47
|
-
lollms_client/stt_bindings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
lollms_client/stt_bindings/lollms/__init__.py,sha256=9Vmn1sQQZKLGLe7nZnc-0LnNeSY8r9xw3pYZF-wVtPo,5889
|
|
49
|
-
lollms_client/stt_bindings/whisper/__init__.py,sha256=1Ej67GdRKBy1bba14jMaYDYHiZkxJASkWm5eF07ztDQ,15363
|
|
50
|
-
lollms_client/stt_bindings/whispercpp/__init__.py,sha256=xSAQRjAhljak3vWCpkP0Vmdb6WmwTzPjXyaIB85KLGU,21439
|
|
51
|
-
lollms_client/tti_bindings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
|
-
lollms_client/tti_bindings/diffusers/__init__.py,sha256=Pi5Zw4nHGXVc0Vcb0ib7KkoiOx__0JukWtL01BUzd7c,41692
|
|
53
|
-
lollms_client/tti_bindings/gemini/__init__.py,sha256=f9fPuqnrBZ1Z-obcoP6EVvbEXNbNCSg21cd5efLCk8U,16707
|
|
54
|
-
lollms_client/tti_bindings/lollms/__init__.py,sha256=5Tnsn4b17djvieQkcjtIDBm3qf0pg5ZWWov-4_2wmo0,8762
|
|
55
|
-
lollms_client/tti_bindings/openai/__init__.py,sha256=YWJolJSQfIzTJvrLQVe8rQewP7rddf6z87g4rnp-lTs,4932
|
|
56
|
-
lollms_client/ttm_bindings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
|
-
lollms_client/ttm_bindings/audiocraft/__init__.py,sha256=a0k6wTrHth6GaVOiNnVboeFY3oKVvCQPbQlqO38XEyc,14328
|
|
58
|
-
lollms_client/ttm_bindings/bark/__init__.py,sha256=Pr3ou2a-7hNYDqbkxrAbghZpO5HvGUhz7e-7VGXIHHA,18976
|
|
59
|
-
lollms_client/ttm_bindings/lollms/__init__.py,sha256=DU3WLmJaWNM1NAMtJsnaFo4Y9wlfc675M8aUiaLnojA,3143
|
|
60
|
-
lollms_client/tts_bindings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
|
-
lollms_client/tts_bindings/bark/__init__.py,sha256=Fqjz5r1aYwggbEfBSHyHB26V8OmbfUlxqH9a9i6HzfQ,4634
|
|
62
|
-
lollms_client/tts_bindings/bark/server/install_bark.py,sha256=y9VhplwOqPwCVx_ex2MzkkBKMaUtzwPiUKg93_1LJzo,2221
|
|
63
|
-
lollms_client/tts_bindings/bark/server/main.py,sha256=jUpjFzbndq4kl8KPykRHG0DdVhUjrAn2GOt6iMt-lIY,12922
|
|
64
|
-
lollms_client/tts_bindings/lollms/__init__.py,sha256=8x2_T9XscvISw2TiaLoFxvrS7TIsVLdqbwSc04cX-wc,7164
|
|
65
|
-
lollms_client/tts_bindings/piper_tts/__init__.py,sha256=FbMw_m2QOn2ny7r5El_s6jByS1dpiuUp7MADudl4VLQ,4855
|
|
66
|
-
lollms_client/tts_bindings/piper_tts/server/install_piper.py,sha256=g71Ne2T18wAytOPipfQ9DNeTAOD9PrII5qC-vr9DtLA,3256
|
|
67
|
-
lollms_client/tts_bindings/piper_tts/server/main.py,sha256=DMozfSR1aCbrlmOXltRFjtXhYhXajsGcNKQjsWgRwZk,17402
|
|
68
|
-
lollms_client/tts_bindings/piper_tts/server/setup_voices.py,sha256=UdHaPa5aNcw8dR-aRGkZr2OfSFFejH79lXgfwT0P3ss,1964
|
|
69
|
-
lollms_client/tts_bindings/xtts/__init__.py,sha256=i1bU6D7wDnWOSf7TRrw_bqeAF6Y8eFp-JIW8z_lWuQM,4211
|
|
70
|
-
lollms_client/tts_bindings/xtts/server/main.py,sha256=T-Kn5NM-u1FJMygeV8rOoZKlqnYHZM30TsnbyZNDzxo,12794
|
|
71
|
-
lollms_client/tts_bindings/xtts/server/setup_voices.py,sha256=UdHaPa5aNcw8dR-aRGkZr2OfSFFejH79lXgfwT0P3ss,1964
|
|
72
|
-
lollms_client/ttv_bindings/__init__.py,sha256=UZ8o2izQOJLQgtZ1D1cXoNST7rzqW22rL2Vufc7ddRc,3141
|
|
73
|
-
lollms_client/ttv_bindings/lollms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
|
-
lollms_client-1.4.1.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
75
|
-
lollms_client-1.4.1.dist-info/METADATA,sha256=eBfpms3EJ5sD7D-xBTXggnqOc1g8IE0inftnXGQmb6w,58689
|
|
76
|
-
lollms_client-1.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
77
|
-
lollms_client-1.4.1.dist-info/top_level.txt,sha256=Bk_kz-ri6Arwsk7YG-T5VsRorV66uVhcHGvb_g2WqgE,14
|
|
78
|
-
lollms_client-1.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|