prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  UnpicklingError: Weights only load failed. Unpickler error: Unsupported class numpy.core.multiarray._reconstruct
  **Describe the bug**
  I tried to update, but I got this exception start from version 3.6.0 during inference
  ```
  UnpicklingError: Weights only load failed. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution.Do it only if you get the file from a trusted source. WeightsUnpickler error: Unsupported class numpy.core.multiarray._reconstruct
  ```
  
  **To Reproduce**
  Steps to reproduce the behavior:
  - Update so-vits-svc-fork
  - Run inference
  
  **Additional context**
  Initially I updated to version 3.8.0, because of the exception I tried to solve by keep downgrading the version until I got to version 3.5.1 to solve the problem.
  
  
  </issue>
  <code>
  [start of src/so_vits_svc_fork/cluster/__init__.py]
  1 from __future__ import annotations
  2 
  3 from pathlib import Path
  4 from typing import Any
  5 
  6 import torch
  7 from sklearn.cluster import KMeans
  8 
  9 
  10 def get_cluster_model(ckpt_path: Path | str):
  11     with Path(ckpt_path).open("rb") as f:
  12         checkpoint = torch.load(f, map_location="cpu", weights_only=True)
  13     kmeans_dict = {}
  14     for spk, ckpt in checkpoint.items():
  15         km = KMeans(ckpt["n_features_in_"])
  16         km.__dict__["n_features_in_"] = ckpt["n_features_in_"]
  17         km.__dict__["_n_threads"] = ckpt["_n_threads"]
  18         km.__dict__["cluster_centers_"] = ckpt["cluster_centers_"]
  19         kmeans_dict[spk] = km
  20     return kmeans_dict
  21 
  22 
  23 def check_speaker(model: Any, speaker: Any):
  24     if speaker not in model:
  25         raise ValueError(f"Speaker {speaker} not in {list(model.keys())}")
  26 
  27 
  28 def get_cluster_result(model: Any, x: Any, speaker: Any):
  29     """
  30     x: np.array [t, 256]
  31     return cluster class result
  32     """
  33     check_speaker(model, speaker)
  34     return model[speaker].predict(x)
  35 
  36 
  37 def get_cluster_center_result(model: Any, x: Any, speaker: Any):
  38     """x: np.array [t, 256]"""
  39     check_speaker(model, speaker)
  40     predict = model[speaker].predict(x)
  41     return model[speaker].cluster_centers_[predict]
  42 
  43 
  44 def get_center(model: Any, x: Any, speaker: Any):
  45     check_speaker(model, speaker)
  46     return model[speaker].cluster_centers_[x]
  47
  [end of src/so_vits_svc_fork/cluster/__init__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/so_vits_svc_fork/cluster/__init__.py b/src/so_vits_svc_fork/cluster/__init__.py
  --- a/src/so_vits_svc_fork/cluster/__init__.py
  +++ b/src/so_vits_svc_fork/cluster/__init__.py
  @@ -9,7 +9,9 @@
   
   def get_cluster_model(ckpt_path: Path | str):
       with Path(ckpt_path).open("rb") as f:
  -        checkpoint = torch.load(f, map_location="cpu", weights_only=True)
  +        checkpoint = torch.load(
  +            f, map_location="cpu"
  +        )  # Danger of arbitrary code execution
       kmeans_dict = {}
       for spk, ckpt in checkpoint.items():
           km = KMeans(ckpt["n_features_in_"])
  
verification_info: {"golden_diff": "diff --git a/src/so_vits_svc_fork/cluster/__init__.py b/src/so_vits_svc_fork/cluster/__init__.py\n--- a/src/so_vits_svc_fork/cluster/__init__.py\n+++ b/src/so_vits_svc_fork/cluster/__init__.py\n@@ -9,7 +9,9 @@\n \n def get_cluster_model(ckpt_path: Path | str):\n     with Path(ckpt_path).open(\"rb\") as f:\n-        checkpoint = torch.load(f, map_location=\"cpu\", weights_only=True)\n+        checkpoint = torch.load(\n+            f, map_location=\"cpu\"\n+        )  # Danger of arbitrary code execution\n     kmeans_dict = {}\n     for spk, ckpt in checkpoint.items():\n         km = KMeans(ckpt[\"n_features_in_\"])\n", "issue": "UnpicklingError: Weights only load failed. Unpickler error: Unsupported class numpy.core.multiarray._reconstruct\n**Describe the bug**\r\nI tried to update, but I got this exception start from version 3.6.0 during inference\r\n```\r\nUnpicklingError: Weights only load failed. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution.Do it only if you get the file from a trusted source. WeightsUnpickler error: Unsupported class numpy.core.multiarray._reconstruct\r\n```\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n- Update so-vits-svc-fork\r\n- Run inference\r\n\r\n**Additional context**\r\nInitially I updated to version 3.8.0, because of the exception I tried to solve by keep downgrading the version until I got to version 3.5.1 to solve the problem.\r\n\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom pathlib import Path\nfrom typing import Any\n\nimport torch\nfrom sklearn.cluster import KMeans\n\n\ndef get_cluster_model(ckpt_path: Path | str):\n    with Path(ckpt_path).open(\"rb\") as f:\n        checkpoint = torch.load(f, map_location=\"cpu\", weights_only=True)\n    kmeans_dict = {}\n    for spk, ckpt in checkpoint.items():\n        km = KMeans(ckpt[\"n_features_in_\"])\n        km.__dict__[\"n_features_in_\"] = ckpt[\"n_features_in_\"]\n        km.__dict__[\"_n_threads\"] = ckpt[\"_n_threads\"]\n        km.__dict__[\"cluster_centers_\"] = ckpt[\"cluster_centers_\"]\n        kmeans_dict[spk] = km\n    return kmeans_dict\n\n\ndef check_speaker(model: Any, speaker: Any):\n    if speaker not in model:\n        raise ValueError(f\"Speaker {speaker} not in {list(model.keys())}\")\n\n\ndef get_cluster_result(model: Any, x: Any, speaker: Any):\n    \"\"\"\n    x: np.array [t, 256]\n    return cluster class result\n    \"\"\"\n    check_speaker(model, speaker)\n    return model[speaker].predict(x)\n\n\ndef get_cluster_center_result(model: Any, x: Any, speaker: Any):\n    \"\"\"x: np.array [t, 256]\"\"\"\n    check_speaker(model, speaker)\n    predict = model[speaker].predict(x)\n    return model[speaker].cluster_centers_[predict]\n\n\ndef get_center(model: Any, x: Any, speaker: Any):\n    check_speaker(model, speaker)\n    return model[speaker].cluster_centers_[x]\n", "path": "src/so_vits_svc_fork/cluster/__init__.py"}]}