We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Crash when training cluster model
**Describe the bug**
Crash when training cluster model.

**To Reproduce**
conda activate so-vits-svc-fork
cd xxx
svc train-cluster

**Additional context**
Crash log:
Loading features from dataset\44k\yyy                              train_cluster.py:24
Training clusters: 100%|█████████████████████████████████████████████████████████████████| 1/1 [00:05<00:00,  5.20s/it]
joblib.externals.loky.process_executor._RemoteTraceback:
"""
Traceback (most recent call last):
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\joblib\externals\loky\process_executor.py", line 428, in _process_worker
    r = call_item()
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\joblib\externals\loky\process_executor.py", line 275, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\joblib\_parallel_backends.py", line 620, in __call__
    return self.func(*args, **kwargs)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\joblib\parallel.py", line 288, in __call__
    return [func(*args, **kwargs)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\joblib\parallel.py", line 288, in <listcomp>
    return [func(*args, **kwargs)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\so_vits_svc_fork\cluster\train_cluster.py", line 71, in train_cluster_
    return input_path.stem, train_cluster(input_path, **kwargs)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\so_vits_svc_fork\cluster\train_cluster.py", line 29, in train_cluster
    features = np.concatenate(features, axis=0).astype(np.float32)
  File "<__array_function__ internals>", line 180, in concatenate
ValueError: need at least one array to concatenate
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\Scripts\svc.exe\__main__.py", line 7, in <module>
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\so_vits_svc_fork\__main__.py", line 810, in train_cluster
    main(
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\so_vits_svc_fork\cluster\train_cluster.py", line 74, in main
    parallel_result = Parallel(n_jobs=-1)(
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\joblib\parallel.py", line 1098, in __call__
    self.retrieve()
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\joblib\parallel.py", line 975, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\site-packages\joblib\_parallel_backends.py", line 567, in wrap_future_result
    return future.result(timeout=timeout)
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\concurrent\futures\_base.py", line 458, in result
    return self.__get_result()
  File "C:\Users\xxx\anaconda3\envs\so-vits-svc-fork\lib\concurrent\futures\_base.py", line 403, in __get_result
    raise self._exception
ValueError: need at least one array to concatenate


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/so_vits_svc_fork/cluster/train_cluster.py`
Content:
```
1 from __future__ import annotations
2 
3 from logging import getLogger
4 from pathlib import Path
5 from typing import Any
6 
7 import numpy as np
8 import torch
9 from cm_time import timer
10 from joblib import Parallel, delayed
11 from sklearn.cluster import KMeans, MiniBatchKMeans
12 from tqdm_joblib import tqdm_joblib
13 
14 LOG = getLogger(__name__)
15 
16 
17 def train_cluster(
18     input_dir: Path | str,
19     n_clusters: int,
20     use_minibatch: bool = True,
21     verbose: bool = False,
22 ) -> dict:
23     input_dir = Path(input_dir)
24     LOG.info(f"Loading features from {input_dir}")
25     features = []
26     nums = 0
27     for path in input_dir.glob("*.soft.pt"):
28         features.append(torch.load(path).squeeze(0).numpy().T)
29     features = np.concatenate(features, axis=0).astype(np.float32)
30     if features.shape[0] < n_clusters:
31         raise ValueError(
32             "Too few HuBERT features to cluster. Consider using a smaller number of clusters."
33         )
34     LOG.info(
35         f"Nums: {nums}, shape: {features.shape}, size: {features.nbytes/1024**2:.2f} MB, dtype: {features.dtype}"
36     )
37     with timer() as t:
38         if use_minibatch:
39             kmeans = MiniBatchKMeans(
40                 n_clusters=n_clusters,
41                 verbose=verbose,
42                 batch_size=4096,
43                 max_iter=80,
44                 n_init="auto",
45             ).fit(features)
46         else:
47             kmeans = KMeans(n_clusters=n_clusters, verbose=verbose, n_init="auto").fit(
48                 features
49             )
50     LOG.info(f"Clustering took {t.elapsed:.2f} seconds")
51 
52     x = {
53         "n_features_in_": kmeans.n_features_in_,
54         "_n_threads": kmeans._n_threads,
55         "cluster_centers_": kmeans.cluster_centers_,
56     }
57     return x
58 
59 
60 def main(
61     input_dir: Path | str,
62     output_path: Path | str,
63     n_clusters: int = 10000,
64     use_minibatch: bool = True,
65     verbose: bool = False,
66 ) -> None:
67     input_dir = Path(input_dir)
68     output_path = Path(output_path)
69 
70     def train_cluster_(input_path: Path, **kwargs: Any) -> tuple[str, dict]:
71         return input_path.stem, train_cluster(input_path, **kwargs)
72 
73     with tqdm_joblib(desc="Training clusters", total=len(list(input_dir.iterdir()))):
74         parallel_result = Parallel(n_jobs=-1)(
75             delayed(train_cluster_)(
76                 speaker_name,
77                 n_clusters=n_clusters,
78                 use_minibatch=use_minibatch,
79                 verbose=verbose,
80             )
81             for speaker_name in input_dir.iterdir()
82         )
83     assert parallel_result is not None
84     checkpoint = dict(parallel_result)
85     output_path.parent.mkdir(exist_ok=True, parents=True)
86     torch.save(checkpoint, output_path)
87
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/so_vits_svc_fork/cluster/train_cluster.py b/src/so_vits_svc_fork/cluster/train_cluster.py
--- a/src/so_vits_svc_fork/cluster/train_cluster.py
+++ b/src/so_vits_svc_fork/cluster/train_cluster.py
@@ -24,8 +24,10 @@
     LOG.info(f"Loading features from {input_dir}")
     features = []
     nums = 0
-    for path in input_dir.glob("*.soft.pt"):
-        features.append(torch.load(path).squeeze(0).numpy().T)
+    for path in input_dir.rglob("*.data.pt"):
+        features.append(
+            torch.load(path, weights_only=True)["content"].squeeze(0).numpy().T
+        )
     features = np.concatenate(features, axis=0).astype(np.float32)
     if features.shape[0] < n_clusters:
         raise ValueError(

{"golden_diff": "diff --git a/src/so_vits_svc_fork/cluster/train_cluster.py b/src/so_vits_svc_fork/cluster/train_cluster.py\n--- a/src/so_vits_svc_fork/cluster/train_cluster.py\n+++ b/src/so_vits_svc_fork/cluster/train_cluster.py\n@@ -24,8 +24,10 @@\n     LOG.info(f\"Loading features from {input_dir}\")\n     features = []\n     nums = 0\n-    for path in input_dir.glob(\"*.soft.pt\"):\n-        features.append(torch.load(path).squeeze(0).numpy().T)\n+    for path in input_dir.rglob(\"*.data.pt\"):\n+        features.append(\n+            torch.load(path, weights_only=True)[\"content\"].squeeze(0).numpy().T\n+        )\n     features = np.concatenate(features, axis=0).astype(np.float32)\n     if features.shape[0] < n_clusters:\n         raise ValueError(\n", "issue": "Crash when training cluster model\n**Describe the bug**\r\nCrash when training cluster model.\r\n\r\n**To Reproduce**\r\nconda activate so-vits-svc-fork\r\ncd xxx\r\nsvc train-cluster\r\n\r\n**Additional context**\r\nCrash log:\r\nLoading features from dataset\\44k\\yyy                              train_cluster.py:24\r\nTraining clusters: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 1/1 [00:05<00:00,  5.20s/it]\r\njoblib.externals.loky.process_executor._RemoteTraceback:\r\n\"\"\"\r\nTraceback (most recent call last):\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\joblib\\externals\\loky\\process_executor.py\", line 428, in _process_worker\r\n    r = call_item()\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\joblib\\externals\\loky\\process_executor.py\", line 275, in __call__\r\n    return self.fn(*self.args, **self.kwargs)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\joblib\\_parallel_backends.py\", line 620, in __call__\r\n    return self.func(*args, **kwargs)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\joblib\\parallel.py\", line 288, in __call__\r\n    return [func(*args, **kwargs)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\joblib\\parallel.py\", line 288, in <listcomp>\r\n    return [func(*args, **kwargs)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\so_vits_svc_fork\\cluster\\train_cluster.py\", line 71, in train_cluster_\r\n    return input_path.stem, train_cluster(input_path, **kwargs)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\so_vits_svc_fork\\cluster\\train_cluster.py\", line 29, in train_cluster\r\n    features = np.concatenate(features, axis=0).astype(np.float32)\r\n  File \"<__array_function__ internals>\", line 180, in concatenate\r\nValueError: need at least one array to concatenate\r\n\"\"\"\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\runpy.py\", line 196, in _run_module_as_main\r\n    return _run_code(code, main_globals, None,\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\runpy.py\", line 86, in _run_code\r\n    exec(code, run_globals)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\Scripts\\svc.exe\\__main__.py\", line 7, in <module>\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\click\\core.py\", line 1130, in __call__\r\n    return self.main(*args, **kwargs)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\click\\core.py\", line 1055, in main\r\n    rv = self.invoke(ctx)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\click\\core.py\", line 1657, in invoke\r\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\click\\core.py\", line 1404, in invoke\r\n    return ctx.invoke(self.callback, **ctx.params)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\click\\core.py\", line 760, in invoke\r\n    return __callback(*args, **kwargs)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\so_vits_svc_fork\\__main__.py\", line 810, in train_cluster\r\n    main(\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\so_vits_svc_fork\\cluster\\train_cluster.py\", line 74, in main\r\n    parallel_result = Parallel(n_jobs=-1)(\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\joblib\\parallel.py\", line 1098, in __call__\r\n    self.retrieve()\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\joblib\\parallel.py\", line 975, in retrieve\r\n    self._output.extend(job.get(timeout=self.timeout))\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\site-packages\\joblib\\_parallel_backends.py\", line 567, in wrap_future_result\r\n    return future.result(timeout=timeout)\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\concurrent\\futures\\_base.py\", line 458, in result\r\n    return self.__get_result()\r\n  File \"C:\\Users\\xxx\\anaconda3\\envs\\so-vits-svc-fork\\lib\\concurrent\\futures\\_base.py\", line 403, in __get_result\r\n    raise self._exception\r\nValueError: need at least one array to concatenate\r\n\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom logging import getLogger\nfrom pathlib import Path\nfrom typing import Any\n\nimport numpy as np\nimport torch\nfrom cm_time import timer\nfrom joblib import Parallel, delayed\nfrom sklearn.cluster import KMeans, MiniBatchKMeans\nfrom tqdm_joblib import tqdm_joblib\n\nLOG = getLogger(__name__)\n\n\ndef train_cluster(\n    input_dir: Path | str,\n    n_clusters: int,\n    use_minibatch: bool = True,\n    verbose: bool = False,\n) -> dict:\n    input_dir = Path(input_dir)\n    LOG.info(f\"Loading features from {input_dir}\")\n    features = []\n    nums = 0\n    for path in input_dir.glob(\"*.soft.pt\"):\n        features.append(torch.load(path).squeeze(0).numpy().T)\n    features = np.concatenate(features, axis=0).astype(np.float32)\n    if features.shape[0] < n_clusters:\n        raise ValueError(\n            \"Too few HuBERT features to cluster. Consider using a smaller number of clusters.\"\n        )\n    LOG.info(\n        f\"Nums: {nums}, shape: {features.shape}, size: {features.nbytes/1024**2:.2f} MB, dtype: {features.dtype}\"\n    )\n    with timer() as t:\n        if use_minibatch:\n            kmeans = MiniBatchKMeans(\n                n_clusters=n_clusters,\n                verbose=verbose,\n                batch_size=4096,\n                max_iter=80,\n                n_init=\"auto\",\n            ).fit(features)\n        else:\n            kmeans = KMeans(n_clusters=n_clusters, verbose=verbose, n_init=\"auto\").fit(\n                features\n            )\n    LOG.info(f\"Clustering took {t.elapsed:.2f} seconds\")\n\n    x = {\n        \"n_features_in_\": kmeans.n_features_in_,\n        \"_n_threads\": kmeans._n_threads,\n        \"cluster_centers_\": kmeans.cluster_centers_,\n    }\n    return x\n\n\ndef main(\n    input_dir: Path | str,\n    output_path: Path | str,\n    n_clusters: int = 10000,\n    use_minibatch: bool = True,\n    verbose: bool = False,\n) -> None:\n    input_dir = Path(input_dir)\n    output_path = Path(output_path)\n\n    def train_cluster_(input_path: Path, **kwargs: Any) -> tuple[str, dict]:\n        return input_path.stem, train_cluster(input_path, **kwargs)\n\n    with tqdm_joblib(desc=\"Training clusters\", total=len(list(input_dir.iterdir()))):\n        parallel_result = Parallel(n_jobs=-1)(\n            delayed(train_cluster_)(\n                speaker_name,\n                n_clusters=n_clusters,\n                use_minibatch=use_minibatch,\n                verbose=verbose,\n            )\n            for speaker_name in input_dir.iterdir()\n        )\n    assert parallel_result is not None\n    checkpoint = dict(parallel_result)\n    output_path.parent.mkdir(exist_ok=True, parents=True)\n    torch.save(checkpoint, output_path)\n", "path": "src/so_vits_svc_fork/cluster/train_cluster.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom logging import getLogger\nfrom pathlib import Path\nfrom typing import Any\n\nimport numpy as np\nimport torch\nfrom cm_time import timer\nfrom joblib import Parallel, delayed\nfrom sklearn.cluster import KMeans, MiniBatchKMeans\nfrom tqdm_joblib import tqdm_joblib\n\nLOG = getLogger(__name__)\n\n\ndef train_cluster(\n    input_dir: Path | str,\n    n_clusters: int,\n    use_minibatch: bool = True,\n    verbose: bool = False,\n) -> dict:\n    input_dir = Path(input_dir)\n    LOG.info(f\"Loading features from {input_dir}\")\n    features = []\n    nums = 0\n    for path in input_dir.rglob(\"*.data.pt\"):\n        features.append(\n            torch.load(path, weights_only=True)[\"content\"].squeeze(0).numpy().T\n        )\n    features = np.concatenate(features, axis=0).astype(np.float32)\n    if features.shape[0] < n_clusters:\n        raise ValueError(\n            \"Too few HuBERT features to cluster. Consider using a smaller number of clusters.\"\n        )\n    LOG.info(\n        f\"Nums: {nums}, shape: {features.shape}, size: {features.nbytes/1024**2:.2f} MB, dtype: {features.dtype}\"\n    )\n    with timer() as t:\n        if use_minibatch:\n            kmeans = MiniBatchKMeans(\n                n_clusters=n_clusters,\n                verbose=verbose,\n                batch_size=4096,\n                max_iter=80,\n                n_init=\"auto\",\n            ).fit(features)\n        else:\n            kmeans = KMeans(n_clusters=n_clusters, verbose=verbose, n_init=\"auto\").fit(\n                features\n            )\n    LOG.info(f\"Clustering took {t.elapsed:.2f} seconds\")\n\n    x = {\n        \"n_features_in_\": kmeans.n_features_in_,\n        \"_n_threads\": kmeans._n_threads,\n        \"cluster_centers_\": kmeans.cluster_centers_,\n    }\n    return x\n\n\ndef main(\n    input_dir: Path | str,\n    output_path: Path | str,\n    n_clusters: int = 10000,\n    use_minibatch: bool = True,\n    verbose: bool = False,\n) -> None:\n    input_dir = Path(input_dir)\n    output_path = Path(output_path)\n\n    def train_cluster_(input_path: Path, **kwargs: Any) -> tuple[str, dict]:\n        return input_path.stem, train_cluster(input_path, **kwargs)\n\n    with tqdm_joblib(desc=\"Training clusters\", total=len(list(input_dir.iterdir()))):\n        parallel_result = Parallel(n_jobs=-1)(\n            delayed(train_cluster_)(\n                speaker_name,\n                n_clusters=n_clusters,\n                use_minibatch=use_minibatch,\n                verbose=verbose,\n            )\n            for speaker_name in input_dir.iterdir()\n        )\n    assert parallel_result is not None\n    checkpoint = dict(parallel_result)\n    output_path.parent.mkdir(exist_ok=True, parents=True)\n    torch.save(checkpoint, output_path)\n", "path": "src/so_vits_svc_fork/cluster/train_cluster.py"}]}