Skip to content

Commit 217fe74

Browse files
Merge from development #836, #837, #838, #839 (#840)
* fix PyYAML loading (#837) * [text to audio generator] Replaced bark with openai tts models (#836) * [Text to audio generator] Add speech engine (#838) * [text to audio generator] Replaced bark with openai tts models * [text to audio generator] Fix base url env var * fix version * Add speech engine * after review * [auto-trainer] update test requirements (#839) * [Build] Fix html links, Add <function>.html as source in documentation * Update CI temporarily and update index * [XGB-Custom] Fix test artifact key name * [XGB-Serving][XGB-Test][XGB-Trainer] Fix tests - artifact key * [Build] Install python 3.9 when testing (#618) * [Build] Update python version in CI (#620) * [Build] Install python 3.9 when testing * [Build] Update python version in CI * . * Revert "[Build] Update python version in CI (#620)" (#621) This reverts commit 0cd1f15. * Revert "[Build] Install python 3.9 when testing (#618)" (#619) This reverts commit 3301415. * [Build] Build with python 3.9 (#622) * [Build] Build with python 3.9 * . * Update requirements.txt --------- Co-authored-by: Yonatan Shelach <[email protected]>
1 parent c9d97fb commit 217fe74

9 files changed

+249
-80
lines changed

auto_trainer/requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pandas
2-
scikit-learn
3-
xgboost
4-
plotly
2+
scikit-learn<1.4.0
3+
xgboost<2.0.0
4+
plotly

cli/item_yaml.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def update_functions_yaml(root_directory: str,
4040
if (inner_dir / item_yaml).exists():
4141
path = str(inner_dir)+"/"+item_yaml
4242
stream = open(path, 'r')
43-
data = yaml.load(stream)
43+
data = yaml.load(stream=stream, Loader=yaml.FullLoader)
4444
if version:
4545
data['version'] = version
4646
if mlrun_version:

cli/test_suite.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ def clean_pipenv(directory: str):
599599
# load item yaml
600600
def load_item(path):
601601
with open(path, 'r') as stream:
602-
data = yaml.load(stream)
602+
data = yaml.load(stream=stream, Loader=yaml.FullLoader)
603603
return data
604604

605605

text_to_audio_generator/function.yaml

+40-36
Large diffs are not rendered by default.

text_to_audio_generator/item.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ labels:
1313
author: yonatans
1414
maintainers: []
1515
marketplaceType: ''
16-
mlrunVersion: 1.5.1
16+
mlrunVersion: 1.7.1
1717
name: text_to_audio_generator
1818
platformVersion: 3.5.3
1919
spec:
@@ -22,8 +22,8 @@ spec:
2222
image: mlrun/mlrun
2323
kind: job
2424
requirements:
25-
- bark
2625
- torchaudio
26+
- pydub
2727
url: ''
28-
version: 1.2.0
28+
version: 1.3.0
2929
test_valid: True
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
bark
2-
torchaudio>=2.1.0
2+
torchaudio>=2.1.0
3+
openai>=1.58.0
4+
pydub

text_to_audio_generator/test_text_to_audio_generator.py

+41-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import mlrun
15+
import os
1616
import tempfile
17+
18+
import mlrun
1719
import pytest
1820

1921

@@ -31,6 +33,7 @@ def test_generate_multi_speakers_audio(file_format, bits_per_sample):
3133
"v2/en_speaker_0",
3234
"v2/en_speaker_1",
3335
],
36+
"engine": "bark",
3437
"use_small_models": True,
3538
"use_gpu": False,
3639
"offload_cpu": True,
@@ -45,6 +48,42 @@ def test_generate_multi_speakers_audio(file_format, bits_per_sample):
4548
],
4649
artifact_path=test_directory,
4750
)
48-
assert function_run.error == "Run state (completed) is not in error state"
51+
assert function_run.error == ""
4952
for key in ["audio_files", "audio_files_dataframe", "text_to_speech_errors"]:
5053
assert key in function_run.outputs and function_run.outputs[key] is not None
54+
55+
56+
@pytest.mark.skipif(
57+
condition=os.getenv("OPENAI_API_BASE") is None
58+
and os.getenv("OPENAI_API_KEY") is None,
59+
reason="OpenAI API key and base URL are required to run this test",
60+
)
61+
@pytest.mark.parametrize("file_format,bits_per_sample", [("wav", 8), ("mp3", None)])
62+
def test_generate_multi_speakers_audio_openai(file_format, bits_per_sample):
63+
text_to_audio_generator_function = mlrun.import_function("function.yaml")
64+
with tempfile.TemporaryDirectory() as test_directory:
65+
function_run = text_to_audio_generator_function.run(
66+
handler="generate_multi_speakers_audio",
67+
inputs={"data_path": "data/test_data.txt"},
68+
params={
69+
"output_directory": test_directory,
70+
"speakers": {"Agent": 0, "Client": 1},
71+
"available_voices": [
72+
"alloy",
73+
"echo",
74+
],
75+
"engine": "openai",
76+
"file_format": file_format,
77+
"bits_per_sample": bits_per_sample,
78+
},
79+
local=True,
80+
returns=[
81+
"audio_files: path",
82+
"audio_files_dataframe: dataset",
83+
"text_to_speech_errors: file",
84+
],
85+
artifact_path=test_directory,
86+
)
87+
assert function_run.error == ""
88+
for key in ["audio_files", "audio_files_dataframe", "text_to_speech_errors"]:
89+
assert key in function_run.outputs and function_run.outputs[key] is not None

text_to_audio_generator/text_to_audio_generator.ipynb

+4-9
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@
3131
"id": "bb20c4a6-f362-40e6-8f73-9145953959ec",
3232
"metadata": {},
3333
"outputs": [],
34-
"source": [
35-
"import mlrun\n",
36-
"import tempfile"
37-
]
34+
"source": "import mlrun"
3835
},
3936
{
4037
"cell_type": "code",
@@ -322,12 +319,10 @@
322319
" \"output_directory\": \"./out\",\n",
323320
" \"speakers\": {\"Agent\": 0, \"Client\": 1},\n",
324321
" \"available_voices\": [\n",
325-
" \"v2/en_speaker_0\",\n",
326-
" \"v2/en_speaker_1\",\n",
322+
" \"alloy\",\n",
323+
" \"echo\",\n",
327324
" ],\n",
328-
" \"use_small_models\": True,\n",
329-
" \"use_gpu\": False,\n",
330-
" \"offload_cpu\": True,\n",
325+
" \"engine\": \"bark\",\n",
331326
" \"file_format\": \"mp3\",\n",
332327
" # \"bits_per_sample\": 8,\n",
333328
" },\n",

0 commit comments

Comments
 (0)