1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-09 04:29:50 +08:00

chore: remove type subscription for np.ndarray specification (#56)

* chore: remove type subscription for np.ndarray specification

this is done to avoid errors on python<3.9

* chore: remove import of `Any` from typing since it's unused
This commit is contained in:
Alex Murkoff
2024-06-14 20:45:45 +07:00
committed by GitHub
parent ed8a0c3e34
commit c7779116c5

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional, Union from typing import Optional, Union
import torch import torch
import numpy as np import numpy as np
@@ -23,12 +23,12 @@ class F0Predictor(object):
def compute_f0( def compute_f0(
self, self,
wav: np.ndarray[Any, np.dtype], wav: np.ndarray,
p_len: Optional[int] = None, p_len: Optional[int] = None,
filter_radius: Optional[Union[int, float]] = None, filter_radius: Optional[Union[int, float]] = None,
): ... ): ...
def _interpolate_f0(self, f0: np.ndarray[Any, np.dtype]): def _interpolate_f0(self, f0: np.ndarray):
""" """
对F0进行插值处理 对F0进行插值处理
""" """
@@ -66,7 +66,7 @@ class F0Predictor(object):
return ip_data[:, 0], vuv_vector[:, 0] return ip_data[:, 0], vuv_vector[:, 0]
def _resize_f0(self, x: np.ndarray[Any, np.dtype], target_len: int): def _resize_f0(self, x: np.ndarray, target_len: int):
source = np.array(x) source = np.array(x)
source[source < 0.001] = np.nan source[source < 0.001] = np.nan
target = np.interp( target = np.interp(