diff --git a/pyproject.toml b/pyproject.toml index 5995fc9..9e68d6d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,6 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", ] dependencies = [ @@ -37,7 +36,7 @@ dependencies = [ 'pydantic', 'pyopenjtalk-dict', 'pypinyin', - 'pyworld', + # 'pyworld', 'safetensors', 'scipy', 'torch>=2.1,<2.2', @@ -74,7 +73,7 @@ cov = [ ] [[tool.hatch.envs.test.matrix]] -python = ["3.9", "3.10", "3.11", "3.12"] +python = ["3.9", "3.10", "3.11"] [tool.coverage.run] source_pkgs = ["style_bert_vits2", "tests"] diff --git a/style_bert_vits2/models/utils/__init__.py b/style_bert_vits2/models/utils/__init__.py index 51e19d9..e0d922f 100644 --- a/style_bert_vits2/models/utils/__init__.py +++ b/style_bert_vits2/models/utils/__init__.py @@ -4,24 +4,27 @@ import os import re import subprocess from pathlib import Path -from typing import Any, Optional, Union +from typing import Any, Optional, Union, TYPE_CHECKING import numpy as np import torch from numpy.typing import NDArray from scipy.io.wavfile import read -from torch.utils.tensorboard import SummaryWriter from style_bert_vits2.logging import logger from style_bert_vits2.models.utils import checkpoints # type: ignore from style_bert_vits2.models.utils import safetensors # type: ignore +if TYPE_CHECKING: + # tensorboard はライブラリとしてインストールされている場合は依存関係に含まれないため、型チェック時のみインポートする + from torch.utils.tensorboard import SummaryWriter + __is_matplotlib_imported = False def summarize( - writer: SummaryWriter, + writer: "SummaryWriter", global_step: int, scalars: dict[str, float] = {}, histograms: dict[str, Any] = {},