Skip to content

Commit

Permalink
FIX: 修正された型ヒントと明示的な型付けを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Feb 17, 2025
1 parent d9d072c commit ed63477
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions voicevox_engine/core/core_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def safe_predict_sing_f0_forward(
phoneme: NDArray[np.int64],
note: NDArray[np.int64],
style_id: StyleId,
) -> np.ndarray[tuple[int], np.dtype[np.float32]]:
) -> NDArray[np.float32]:
# 「指定スタイルを初期化」「mutexによる安全性」「コア仕様に従う無音付加」「系列長・データ型に関するアダプター」を提供する
self.initialize_style_id_synthesis(style_id, skip_reinit=True)

Expand All @@ -237,7 +237,7 @@ def safe_predict_sing_volume_forward(
note: NDArray[np.int64],
f0: NDArray[np.float32],
style_id: StyleId,
) -> np.ndarray[tuple[int], np.dtype[np.float32]]:
) -> NDArray[np.float32]:
# 「指定スタイルを初期化」「mutexによる安全性」「コア仕様に従う無音付加」「系列長・データ型に関するアダプター」を提供する
self.initialize_style_id_synthesis(style_id, skip_reinit=True)

Expand Down
10 changes: 7 additions & 3 deletions voicevox_engine/tts_pipeline/tts_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,11 @@ def create_sing_phoneme_and_f0_and_volume(
)
]

return phoneme_data_list, f0s.tolist(), volumes.tolist()
# mypyの型チェックを通すために明示的に型を付ける
f0_list: list[float] = f0s.tolist() # type: ignore
volume_list: list[float] = volumes.tolist() # type: ignore

return phoneme_data_list, f0_list, volume_list

def create_sing_f0_from_phoneme(
self,
Expand Down Expand Up @@ -700,7 +704,7 @@ def create_sing_f0_from_phoneme(
)

# mypyの型チェックを通すために明示的に型を付ける
f0_list: list[float] = f0s.tolist()
f0_list: list[float] = f0s.tolist() # type: ignore

return f0_list

Expand Down Expand Up @@ -752,7 +756,7 @@ def create_sing_volume_from_phoneme_and_f0(
)

# mypyの型チェックを通すために明示的に型を付ける
volume_list: list[float] = volumes.tolist()
volume_list: list[float] = volumes.tolist() # type: ignore

return volume_list

Expand Down

0 comments on commit ed63477

Please sign in to comment.