From ed7bdda0001e231724c5af40bc329137e7ca7e2e Mon Sep 17 00:00:00 2001 From: michelia Date: Fri, 22 Nov 2024 09:58:01 +0800 Subject: [PATCH] refactor: rename speech-box to vox-box --- .flake8 | 2 +- hack/build.sh | 28 +++++++++---------- hack/ci.sh | 4 +-- hack/install.sh | 6 ++-- hack/lib/init.sh | 4 +-- hack/lib/log.sh | 20 ++++++------- hack/lib/util.sh | 12 ++++---- hack/lib/version.sh | 2 +- hack/lint.sh | 8 +++--- hack/test.sh | 4 +-- hack/windows/build.ps1 | 4 +-- hack/windows/install.ps1 | 2 +- hack/windows/lint.ps1 | 2 +- pyproject.toml | 6 ++-- {speech_box => vox_box}/__init__.py | 0 {speech_box => vox_box}/backends/stt/base.py | 2 +- .../backends/stt/faster_whisper.py | 8 +++--- .../backends/stt/funasr.py | 8 +++--- {speech_box => vox_box}/backends/tts/bark.py | 10 +++---- {speech_box => vox_box}/backends/tts/base.py | 4 +-- .../backends/tts/cosyvoice.py | 10 +++---- {speech_box => vox_box}/cmd/__init__.py | 0 {speech_box => vox_box}/cmd/start.py | 14 +++++----- {speech_box => vox_box}/cmd/version.py | 2 +- {speech_box => vox_box}/config/__init__.py | 0 {speech_box => vox_box}/config/config.py | 2 +- .../downloader/downloaders.py | 2 +- {speech_box => vox_box}/downloader/hub.py | 0 {speech_box => vox_box}/elstimator/bark.py | 8 +++--- {speech_box => vox_box}/elstimator/base.py | 2 +- .../elstimator/cosyvoice.py | 8 +++--- .../elstimator/estimate.py | 14 +++++----- .../elstimator/faster_whisper.py | 10 +++---- {speech_box => vox_box}/elstimator/funasr.py | 8 +++--- {speech_box => vox_box}/logging.py | 0 {speech_box => vox_box}/main.py | 4 +-- {speech_box => vox_box}/server/app.py | 6 ++-- {speech_box => vox_box}/server/model.py | 18 ++++++------ {speech_box => vox_box}/server/routers.py | 6 ++-- {speech_box => vox_box}/server/server.py | 6 ++-- .../utils/compat_importlib.py | 0 {speech_box => vox_box}/utils/ffmpeg.py | 0 {speech_box => vox_box}/utils/file.py | 0 {speech_box => vox_box}/utils/log.py | 0 {speech_box => vox_box}/utils/model.py | 4 +-- 45 files changed, 130 insertions(+), 130 deletions(-) rename {speech_box => vox_box}/__init__.py (100%) rename {speech_box => vox_box}/backends/stt/base.py (93%) rename {speech_box => vox_box}/backends/stt/faster_whisper.py (95%) rename {speech_box => vox_box}/backends/stt/funasr.py (93%) rename {speech_box => vox_box}/backends/tts/bark.py (91%) rename {speech_box => vox_box}/backends/tts/base.py (87%) rename {speech_box => vox_box}/backends/tts/cosyvoice.py (91%) rename {speech_box => vox_box}/cmd/__init__.py (100%) rename {speech_box => vox_box}/cmd/start.py (92%) rename {speech_box => vox_box}/cmd/version.py (91%) rename {speech_box => vox_box}/config/__init__.py (100%) rename {speech_box => vox_box}/config/config.py (93%) rename {speech_box => vox_box}/downloader/downloaders.py (99%) rename {speech_box => vox_box}/downloader/hub.py (100%) rename {speech_box => vox_box}/elstimator/bark.py (92%) rename {speech_box => vox_box}/elstimator/base.py (83%) rename {speech_box => vox_box}/elstimator/cosyvoice.py (89%) rename {speech_box => vox_box}/elstimator/estimate.py (58%) rename {speech_box => vox_box}/elstimator/faster_whisper.py (93%) rename {speech_box => vox_box}/elstimator/funasr.py (92%) rename {speech_box => vox_box}/logging.py (100%) rename {speech_box => vox_box}/main.py (88%) rename {speech_box => vox_box}/server/app.py (86%) rename {speech_box => vox_box}/server/model.py (80%) rename {speech_box => vox_box}/server/routers.py (96%) rename {speech_box => vox_box}/server/server.py (86%) rename {speech_box => vox_box}/utils/compat_importlib.py (100%) rename {speech_box => vox_box}/utils/ffmpeg.py (100%) rename {speech_box => vox_box}/utils/file.py (100%) rename {speech_box => vox_box}/utils/log.py (100%) rename {speech_box => vox_box}/utils/model.py (81%) diff --git a/.flake8 b/.flake8 index 1571611..2b47343 100644 --- a/.flake8 +++ b/.flake8 @@ -11,4 +11,4 @@ exclude = .venv, .pytest_cache, .mypy_cache - speech_box/third_party + vox_box/third_party diff --git a/hack/build.sh b/hack/build.sh index e6252c0..65a3bfd 100755 --- a/hack/build.sh +++ b/hack/build.sh @@ -8,9 +8,9 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" source "${ROOT_DIR}/hack/lib/init.sh" function build() { - if speech_box::util::is_darwin; then + if vox_box::util::is_darwin; then build_platform "macosx_11_0_universal2" - elif speech_box::util::is_linux; then + elif vox_box::util::is_linux; then # This is a temporary workaround to make the wheel files different. echo >> "${ROOT_DIR}/README.md" build_platform "manylinux2014_x86_64" @@ -18,7 +18,7 @@ function build() { build_platform "manylinux2014_aarch64" # Remove the extra newline. # shellcheck disable=SC2016 - speech_box::util::sed '${/^$/d;}' "${ROOT_DIR}/README.md" + vox_box::util::sed '${/^$/d;}' "${ROOT_DIR}/README.md" fi } @@ -26,7 +26,7 @@ function build() { function build_platform() { platform="${1:-}" if [ -z "$platform" ]; then - speech_box::log::fatal "undefined platform to build" + vox_box::log::fatal "undefined platform to build" fi poetry build @@ -34,7 +34,7 @@ function build_platform() { dist_dir="$ROOT_DIR/dist" whl_files=$(find "$dist_dir" -name "*.whl") if [ -z "$whl_files" ]; then - speech_box::log::fatal "no wheel files found in $dist_dir" + vox_box::log::fatal "no wheel files found in $dist_dir" fi for whl_file in $whl_files; do @@ -42,7 +42,7 @@ function build_platform() { original_name=$(basename "$whl_file") new_name="${original_name/any/$platform}" mv -f "$whl_file" "$dist_dir/$new_name" - speech_box::log::info "renamed $original_name to $new_name" + vox_box::log::info "renamed $original_name to $new_name" fi done } @@ -52,23 +52,23 @@ function prepare_dependencies() { } function set_version() { - local version_file="${ROOT_DIR}/speech_box/__init__.py" + local version_file="${ROOT_DIR}/vox_box/__init__.py" local git_commit="${GIT_COMMIT:-HEAD}" local git_commit_short="${git_commit:0:7}" - speech_box::log::info "setting version to $GIT_VERSION" - speech_box::log::info "setting git commit to $git_commit_short" + vox_box::log::info "setting version to $GIT_VERSION" + vox_box::log::info "setting git commit to $git_commit_short" # Replace the __version__ variable in the __init__.py file - speech_box::util::sed "s/__version__ = .*/__version__ = '${GIT_VERSION}'/" "${version_file}" - speech_box::util::sed "s/__git_commit__ = .*/__git_commit__ = '${git_commit_short}'/" "${version_file}" + vox_box::util::sed "s/__version__ = .*/__version__ = '${GIT_VERSION}'/" "${version_file}" + vox_box::util::sed "s/__git_commit__ = .*/__git_commit__ = '${git_commit_short}'/" "${version_file}" # Update the poetry version poetry version "${GIT_VERSION}" } function restore_version_file() { - local version_file="${ROOT_DIR}/speech_box/__init__.py" + local version_file="${ROOT_DIR}/vox_box/__init__.py" git checkout -- "${version_file}" } @@ -76,9 +76,9 @@ function restore_version_file() { # main # -speech_box::log::info "+++ BUILD +++" +vox_box::log::info "+++ BUILD +++" prepare_dependencies set_version build restore_version_file -speech_box::log::info "--- BUILD ---" +vox_box::log::info "--- BUILD ---" diff --git a/hack/ci.sh b/hack/ci.sh index 964cafa..e0b4ceb 100755 --- a/hack/ci.sh +++ b/hack/ci.sh @@ -18,6 +18,6 @@ function ci() { # main # -speech_box::log::info "+++ CI +++" +vox_box::log::info "+++ CI +++" ci "$@" -speech_box::log::info "--- CI ---" +vox_box::log::info "--- CI ---" diff --git a/hack/install.sh b/hack/install.sh index 69abcf3..3bf8b0b 100755 --- a/hack/install.sh +++ b/hack/install.sh @@ -13,7 +13,7 @@ source "${ROOT_DIR}/hack/lib/init.sh" function download_deps() { git submodule update --init --recursive - rm -rf "${ROOT_DIR}/speech_box/third_party/CosyVoice/third_party/Matcha-TTS/data" + rm -rf "${ROOT_DIR}/vox_box/third_party/CosyVoice/third_party/Matcha-TTS/data" pip install poetry==1.8.3 pre-commit==4.0.1 poetry install @@ -24,6 +24,6 @@ function download_deps() { # main # -speech_box::log::info "+++ DEPENDENCIES +++" +vox_box::log::info "+++ DEPENDENCIES +++" download_deps -speech_box::log::info "--- DEPENDENCIES ---" +vox_box::log::info "--- DEPENDENCIES ---" diff --git a/hack/lib/init.sh b/hack/lib/init.sh index 6594392..0d85340 100755 --- a/hack/lib/init.sh +++ b/hack/lib/init.sh @@ -19,5 +19,5 @@ for file in "${ROOT_DIR}/hack/lib/"*; do fi done -speech_box::log::install_errexit -speech_box::version::get_version_vars +vox_box::log::install_errexit +vox_box::version::get_version_vars diff --git a/hack/lib/log.sh b/hack/lib/log.sh index ccba323..79b33a2 100755 --- a/hack/lib/log.sh +++ b/hack/lib/log.sh @@ -14,7 +14,7 @@ log_level="${LOG_LEVEL:-"debug"}" log_colorful="${LOG_COLORFUL:-"true"}" # Handler for when we exit automatically on an error. -speech_box::log::errexit() { +vox_box::log::errexit() { local err="${PIPESTATUS[*]}" # if the shell we are in doesn't have errexit set (common in subshells) then @@ -22,13 +22,13 @@ speech_box::log::errexit() { set +o | grep -qe "-o errexit" || return set +o xtrace - speech_box::log::panic "${BASH_SOURCE[1]}:${BASH_LINENO[0]} '${BASH_COMMAND}' exited with status ${err}" "${1:-1}" + vox_box::log::panic "${BASH_SOURCE[1]}:${BASH_LINENO[0]} '${BASH_COMMAND}' exited with status ${err}" "${1:-1}" } -speech_box::log::install_errexit() { +vox_box::log::install_errexit() { # trap ERR to provide an error handler whenever a command exits nonzero, this # is a more verbose version of set -o errexit - trap 'speech_box::log::errexit' ERR + trap 'vox_box::log::errexit' ERR # setting errtrace allows our ERR trap handler to be propagated to functions, # expansions and subshells @@ -36,7 +36,7 @@ speech_box::log::install_errexit() { } # Debug level logging. -speech_box::log::debug() { +vox_box::log::debug() { [[ ${log_level} == "debug" ]] || return 0 local message="${2:-}" @@ -50,7 +50,7 @@ speech_box::log::debug() { } # Info level logging. -speech_box::log::info() { +vox_box::log::info() { [[ ${log_level} == "debug" ]] || [[ ${log_level} == "info" ]] || return 0 local message="${2:-}" @@ -68,7 +68,7 @@ speech_box::log::info() { } # Warn level logging. -speech_box::log::warn() { +vox_box::log::warn() { local message="${2:-}" local timestamp @@ -85,7 +85,7 @@ speech_box::log::warn() { } # Error level logging, log an error but keep going, don't dump the stack or exit. -speech_box::log::error() { +vox_box::log::error() { local message="${2:-}" local timestamp @@ -102,7 +102,7 @@ speech_box::log::error() { } # Fatal level logging, log an error but exit with 1, don't dump the stack or exit. -speech_box::log::fatal() { +vox_box::log::fatal() { local message="${2:-}" local timestamp @@ -125,7 +125,7 @@ speech_box::log::fatal() { # $1 Message to log with the error # $2 The error code to return # $3 The number of stack frames to skip when printing. -speech_box::log::panic() { +vox_box::log::panic() { local message="${1:-}" local code="${2:-1}" diff --git a/hack/lib/util.sh b/hack/lib/util.sh index a43f7b9..b71fef5 100644 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash -function speech_box::util::sed() { +function vox_box::util::sed() { if ! sed -i "$@" >/dev/null 2>&1; then # back off none GNU sed sed -i "" "$@" fi } -function speech_box::util::get_os_name() { +function vox_box::util::get_os_name() { # Support overriding by BUILD_OS for cross-building local os_name="${BUILD_OS:-}" if [[ -n "$os_name" ]]; then @@ -18,10 +18,10 @@ function speech_box::util::get_os_name() { fi } -function speech_box::util::is_darwin() { - [[ "$(speech_box::util::get_os_name)" == "darwin" ]] +function vox_box::util::is_darwin() { + [[ "$(vox_box::util::get_os_name)" == "darwin" ]] } -function speech_box::util::is_linux() { - [[ "$(speech_box::util::get_os_name)" == "linux" ]] +function vox_box::util::is_linux() { + [[ "$(vox_box::util::get_os_name)" == "linux" ]] } diff --git a/hack/lib/version.sh b/hack/lib/version.sh index 3ac62a3..263ba8f 100755 --- a/hack/lib/version.sh +++ b/hack/lib/version.sh @@ -18,7 +18,7 @@ # it can be specified via "VERSION". # BUILD_DATE - The build date of the version. -function speech_box::version::get_version_vars() { +function vox_box::version::get_version_vars() { #shellcheck disable=SC2034 BUILD_DATE=$(date -u '+%Y-%m-%dT%H:%M:%SZ') GIT_TREE_STATE="unknown" diff --git a/hack/lint.sh b/hack/lint.sh index 699bc11..1cdccb8 100755 --- a/hack/lint.sh +++ b/hack/lint.sh @@ -10,7 +10,7 @@ source "${ROOT_DIR}/hack/lib/init.sh" function lint() { local path="$1" - speech_box::log::info "linting ${path}" + vox_box::log::info "linting ${path}" pre-commit run --all-files } @@ -18,6 +18,6 @@ function lint() { # main # -speech_box::log::info "+++ LINT +++" -lint "speech_box" -speech_box::log::info "--- LINT ---" +vox_box::log::info "+++ LINT +++" +lint "vox_box" +vox_box::log::info "--- LINT ---" diff --git a/hack/test.sh b/hack/test.sh index 85eb703..fd39262 100755 --- a/hack/test.sh +++ b/hack/test.sh @@ -15,6 +15,6 @@ function test() { # main # -speech_box::log::info "+++ TEST +++" +vox_box::log::info "+++ TEST +++" test -speech_box::log::info "--- TEST ---" +vox_box::log::info "--- TEST ---" diff --git a/hack/windows/build.ps1 b/hack/windows/build.ps1 index 0c714c8..c94a84b 100644 --- a/hack/windows/build.ps1 +++ b/hack/windows/build.ps1 @@ -36,7 +36,7 @@ function Install-Dependency { } function Set-Version { - $versionFile = Join-Path -Path $ROOT_DIR -ChildPath "speech_box\__init__.py" + $versionFile = Join-Path -Path $ROOT_DIR -ChildPath "vox_box\__init__.py" $version = if ($null -ne $global:GIT_VERSION) { $global:GIT_VERSION } else { "0.0.0" } $gitCommit = if ($null -ne $global:GIT_COMMIT) { $global:GIT_COMMIT } else { "HEAD" } $gitCommitShort = $gitCommit.Substring(0, [Math]::Min(7, $gitCommit.Length)) @@ -55,7 +55,7 @@ function Set-Version { } function Restore-Version-File { - $versionFile = Join-Path -Path $ROOT_DIR -ChildPath "speech_box\__init__.py" + $versionFile = Join-Path -Path $ROOT_DIR -ChildPath "vox_box\__init__.py" git checkout -- $versionFile if ($LASTEXITCODE -ne 0) { diff --git a/hack/windows/install.ps1 b/hack/windows/install.ps1 index 18a5340..54f834e 100644 --- a/hack/windows/install.ps1 +++ b/hack/windows/install.ps1 @@ -9,7 +9,7 @@ $ROOT_DIR = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent | Split- function Install-Dependency { git submodule update --init --recursive - Remove-Item -Recurse -Force "$ROOT_DIR/speech_box/third_party/CosyVoice/third_party/Matcha-TTS/data" + Remove-Item -Recurse -Force "$ROOT_DIR/vox_box/third_party/CosyVoice/third_party/Matcha-TTS/data" pip install poetry==1.8.3 pre-commit==4.0.1 if ($LASTEXITCODE -ne 0) { diff --git a/hack/windows/lint.ps1 b/hack/windows/lint.ps1 index 57053d0..28809b6 100644 --- a/hack/windows/lint.ps1 +++ b/hack/windows/lint.ps1 @@ -55,7 +55,7 @@ function Lint { SpeechBox.Log.Info "+++ LINT +++" try { Get-PSScriptAnalyzer - Lint "speech_box" + Lint "vox_box" } catch { SpeechBox.Log.Fatal "failed to lint: $($_.Exception.Message)" diff --git a/pyproject.toml b/pyproject.toml index a83a60f..6bb57d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] -name = "speech_box" +name = "vox_box" version = "0.0.0" -description = "Speech box" +description = "Vox box" authors = ["GPUStack Authors "] readme = "README.md" @@ -87,4 +87,4 @@ requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.poetry.scripts] -speech-box = "speech_box.main:main" +vox-box = "vox_box.main:main" diff --git a/speech_box/__init__.py b/vox_box/__init__.py similarity index 100% rename from speech_box/__init__.py rename to vox_box/__init__.py diff --git a/speech_box/backends/stt/base.py b/vox_box/backends/stt/base.py similarity index 93% rename from speech_box/backends/stt/base.py rename to vox_box/backends/stt/base.py index ae8723d..48d5fa9 100644 --- a/speech_box/backends/stt/base.py +++ b/vox_box/backends/stt/base.py @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod from typing import Dict, List, Optional -from speech_box.config.config import Config +from vox_box.config.config import Config class STTBackend(ABC): diff --git a/speech_box/backends/stt/faster_whisper.py b/vox_box/backends/stt/faster_whisper.py similarity index 95% rename from speech_box/backends/stt/faster_whisper.py rename to vox_box/backends/stt/faster_whisper.py index ae25139..7f80ae3 100644 --- a/speech_box/backends/stt/faster_whisper.py +++ b/vox_box/backends/stt/faster_whisper.py @@ -6,10 +6,10 @@ from typing import Dict, List, Optional import tempfile import io -from speech_box.backends.stt.base import STTBackend -from speech_box.config.config import BackendEnum, Config, TaskTypeEnum -from speech_box.utils.log import log_method -from speech_box.utils.model import create_model_dict +from vox_box.backends.stt.base import STTBackend +from vox_box.config.config import BackendEnum, Config, TaskTypeEnum +from vox_box.utils.log import log_method +from vox_box.utils.model import create_model_dict from faster_whisper.transcribe import WhisperModel logger = logging.getLogger(__name__) diff --git a/speech_box/backends/stt/funasr.py b/vox_box/backends/stt/funasr.py similarity index 93% rename from speech_box/backends/stt/funasr.py rename to vox_box/backends/stt/funasr.py index d63d3c5..9f16c4f 100644 --- a/speech_box/backends/stt/funasr.py +++ b/vox_box/backends/stt/funasr.py @@ -3,10 +3,10 @@ import os from typing import Dict, List, Optional import tempfile -from speech_box.backends.stt.base import STTBackend -from speech_box.config.config import BackendEnum, Config, TaskTypeEnum -from speech_box.utils.log import log_method -from speech_box.utils.model import create_model_dict +from vox_box.backends.stt.base import STTBackend +from vox_box.config.config import BackendEnum, Config, TaskTypeEnum +from vox_box.utils.log import log_method +from vox_box.utils.model import create_model_dict logger = logging.getLogger(__name__) diff --git a/speech_box/backends/tts/bark.py b/vox_box/backends/tts/bark.py similarity index 91% rename from speech_box/backends/tts/bark.py rename to vox_box/backends/tts/bark.py index 38b591f..2341b17 100644 --- a/speech_box/backends/tts/bark.py +++ b/vox_box/backends/tts/bark.py @@ -3,14 +3,14 @@ import tempfile from typing import Dict, List, Optional -from speech_box.backends.tts.base import TTSBackend -from speech_box.config.config import BackendEnum, Config, TaskTypeEnum +from vox_box.backends.tts.base import TTSBackend +from vox_box.config.config import BackendEnum, Config, TaskTypeEnum from transformers import AutoProcessor, BarkModel from scipy.io.wavfile import write as write_wav -from speech_box.utils.ffmpeg import convert -from speech_box.utils.log import log_method -from speech_box.utils.model import create_model_dict +from vox_box.utils.ffmpeg import convert +from vox_box.utils.log import log_method +from vox_box.utils.model import create_model_dict class Bark(TTSBackend): diff --git a/speech_box/backends/tts/base.py b/vox_box/backends/tts/base.py similarity index 87% rename from speech_box/backends/tts/base.py rename to vox_box/backends/tts/base.py index 945e082..dab637e 100644 --- a/speech_box/backends/tts/base.py +++ b/vox_box/backends/tts/base.py @@ -1,8 +1,8 @@ from abc import ABC, abstractmethod import logging from typing import Dict, Optional -from speech_box.config.config import Config -from speech_box.utils.log import log_method +from vox_box.config.config import Config +from vox_box.utils.log import log_method logger = logging.getLogger(__name__) diff --git a/speech_box/backends/tts/cosyvoice.py b/vox_box/backends/tts/cosyvoice.py similarity index 91% rename from speech_box/backends/tts/cosyvoice.py rename to vox_box/backends/tts/cosyvoice.py index a6e969d..b517a17 100644 --- a/speech_box/backends/tts/cosyvoice.py +++ b/vox_box/backends/tts/cosyvoice.py @@ -5,11 +5,11 @@ import tempfile from typing import Dict, List, Optional -from speech_box.backends.tts.base import TTSBackend -from speech_box.utils.log import log_method -from speech_box.config.config import BackendEnum, Config, TaskTypeEnum -from speech_box.utils.ffmpeg import convert -from speech_box.utils.model import create_model_dict +from vox_box.backends.tts.base import TTSBackend +from vox_box.utils.log import log_method +from vox_box.config.config import BackendEnum, Config, TaskTypeEnum +from vox_box.utils.ffmpeg import convert +from vox_box.utils.model import create_model_dict paths_to_insert = [ os.path.join(os.path.dirname(__file__), "../../third_party/CosyVoice"), diff --git a/speech_box/cmd/__init__.py b/vox_box/cmd/__init__.py similarity index 100% rename from speech_box/cmd/__init__.py rename to vox_box/cmd/__init__.py diff --git a/speech_box/cmd/start.py b/vox_box/cmd/start.py similarity index 92% rename from speech_box/cmd/start.py rename to vox_box/cmd/start.py index fd4ca0d..0653c7a 100644 --- a/speech_box/cmd/start.py +++ b/vox_box/cmd/start.py @@ -3,10 +3,10 @@ import logging import os -from speech_box.logging import setup_logging -from speech_box.config import Config -from speech_box.server.model import ModelInstance -from speech_box.server.server import Server +from vox_box.logging import setup_logging +from vox_box.config import Config +from vox_box.server.model import ModelInstance +from vox_box.server.server import Server logger = logging.getLogger(__name__) @@ -28,8 +28,8 @@ def __call__(self, parser, namespace, values, option_string=None): def setup_start_cmd(subparsers: argparse._SubParsersAction): parser_server: argparse.ArgumentParser = subparsers.add_parser( "start", - help="Run speech-box api server.", - description="Run speech-box api server.", + help="Run vox-box api server.", + description="Run vox-box api server.", ) group = parser_server.add_argument_group("Common settings") @@ -137,7 +137,7 @@ def validate_args(args: argparse.Namespace): def get_data_dir(): - app_name = "speech-box" + app_name = "vox-box" if os.name == "nt": # Windows data_dir = os.path.join(os.environ["APPDATA"], app_name) elif os.name == "posix": diff --git a/speech_box/cmd/version.py b/vox_box/cmd/version.py similarity index 91% rename from speech_box/cmd/version.py rename to vox_box/cmd/version.py index 0abe06b..832825b 100644 --- a/speech_box/cmd/version.py +++ b/vox_box/cmd/version.py @@ -1,5 +1,5 @@ import argparse -from speech_box import __version__, __git_commit__ +from vox_box import __version__, __git_commit__ def setup_version_cmd(subparsers: argparse._SubParsersAction): diff --git a/speech_box/config/__init__.py b/vox_box/config/__init__.py similarity index 100% rename from speech_box/config/__init__.py rename to vox_box/config/__init__.py diff --git a/speech_box/config/config.py b/vox_box/config/config.py similarity index 93% rename from speech_box/config/config.py rename to vox_box/config/config.py index 4bf04ac..ccbb413 100644 --- a/speech_box/config/config.py +++ b/vox_box/config/config.py @@ -3,7 +3,7 @@ class Config: - """A class used to define speech-box configuration. + """A class used to define vox-box configuration. Attributes: debug: Enable debug mode. diff --git a/speech_box/downloader/downloaders.py b/vox_box/downloader/downloaders.py similarity index 99% rename from speech_box/downloader/downloaders.py rename to vox_box/downloader/downloaders.py index f94dff5..92cea67 100644 --- a/speech_box/downloader/downloaders.py +++ b/vox_box/downloader/downloaders.py @@ -12,7 +12,7 @@ snapshot_download as modelscope_snapshot_download, ) from modelscope.hub.utils.utils import model_id_to_group_owner_name -from speech_box.downloader.hub import ( +from vox_box.downloader.hub import ( match_hugging_face_files, match_model_scope_file_paths, ) diff --git a/speech_box/downloader/hub.py b/vox_box/downloader/hub.py similarity index 100% rename from speech_box/downloader/hub.py rename to vox_box/downloader/hub.py diff --git a/speech_box/elstimator/bark.py b/vox_box/elstimator/bark.py similarity index 92% rename from speech_box/elstimator/bark.py rename to vox_box/elstimator/bark.py index 08744a4..8aae0ee 100644 --- a/speech_box/elstimator/bark.py +++ b/vox_box/elstimator/bark.py @@ -2,10 +2,10 @@ import logging import os from typing import Dict -from speech_box.config.config import BackendEnum, Config, TaskTypeEnum -from speech_box.downloader.downloaders import download_model -from speech_box.elstimator.base import Elstimator -from speech_box.utils.model import create_model_dict +from vox_box.config.config import BackendEnum, Config, TaskTypeEnum +from vox_box.downloader.downloaders import download_model +from vox_box.elstimator.base import Elstimator +from vox_box.utils.model import create_model_dict logger = logging.getLogger(__name__) diff --git a/speech_box/elstimator/base.py b/vox_box/elstimator/base.py similarity index 83% rename from speech_box/elstimator/base.py rename to vox_box/elstimator/base.py index 9375d2d..088de42 100644 --- a/speech_box/elstimator/base.py +++ b/vox_box/elstimator/base.py @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod from typing import Dict -from speech_box.config.config import Config +from vox_box.config.config import Config class Elstimator(ABC): diff --git a/speech_box/elstimator/cosyvoice.py b/vox_box/elstimator/cosyvoice.py similarity index 89% rename from speech_box/elstimator/cosyvoice.py rename to vox_box/elstimator/cosyvoice.py index 6b8f264..2d51a39 100644 --- a/speech_box/elstimator/cosyvoice.py +++ b/vox_box/elstimator/cosyvoice.py @@ -2,11 +2,11 @@ import os from typing import Dict -from speech_box.downloader.downloaders import download_model -from speech_box.elstimator.base import Elstimator +from vox_box.downloader.downloaders import download_model +from vox_box.elstimator.base import Elstimator -from speech_box.config.config import BackendEnum, Config, TaskTypeEnum -from speech_box.utils.model import create_model_dict +from vox_box.config.config import BackendEnum, Config, TaskTypeEnum +from vox_box.utils.model import create_model_dict logger = logging.getLogger(__name__) diff --git a/speech_box/elstimator/estimate.py b/vox_box/elstimator/estimate.py similarity index 58% rename from speech_box/elstimator/estimate.py rename to vox_box/elstimator/estimate.py index a2bc8d2..7a02d87 100644 --- a/speech_box/elstimator/estimate.py +++ b/vox_box/elstimator/estimate.py @@ -1,11 +1,11 @@ from typing import Dict, List -from speech_box.config.config import Config -from speech_box.elstimator.bark import Bark -from speech_box.elstimator.base import Elstimator -from speech_box.elstimator.cosyvoice import CosyVoice -from speech_box.elstimator.faster_whisper import FasterWhisper -from speech_box.elstimator.funasr import FunASR -from speech_box.utils.model import create_model_dict +from vox_box.config.config import Config +from vox_box.elstimator.bark import Bark +from vox_box.elstimator.base import Elstimator +from vox_box.elstimator.cosyvoice import CosyVoice +from vox_box.elstimator.faster_whisper import FasterWhisper +from vox_box.elstimator.funasr import FunASR +from vox_box.utils.model import create_model_dict def estimate_model(cfg: Config) -> Dict: diff --git a/speech_box/elstimator/faster_whisper.py b/vox_box/elstimator/faster_whisper.py similarity index 93% rename from speech_box/elstimator/faster_whisper.py rename to vox_box/elstimator/faster_whisper.py index e10da6e..3f5172d 100644 --- a/speech_box/elstimator/faster_whisper.py +++ b/vox_box/elstimator/faster_whisper.py @@ -2,11 +2,11 @@ import logging import os from typing import Dict, List -from speech_box.config.config import BackendEnum, Config, TaskTypeEnum -from speech_box.downloader.downloaders import download_model -from speech_box.downloader.hub import match_files -from speech_box.elstimator.base import Elstimator -from speech_box.utils.model import create_model_dict +from vox_box.config.config import BackendEnum, Config, TaskTypeEnum +from vox_box.downloader.downloaders import download_model +from vox_box.downloader.hub import match_files +from vox_box.elstimator.base import Elstimator +from vox_box.utils.model import create_model_dict from faster_whisper.transcribe import WhisperModel logger = logging.getLogger(__name__) diff --git a/speech_box/elstimator/funasr.py b/vox_box/elstimator/funasr.py similarity index 92% rename from speech_box/elstimator/funasr.py rename to vox_box/elstimator/funasr.py index 5bd2603..c448bf2 100644 --- a/speech_box/elstimator/funasr.py +++ b/vox_box/elstimator/funasr.py @@ -2,10 +2,10 @@ import logging import os from typing import Dict -from speech_box.config.config import BackendEnum, Config, TaskTypeEnum -from speech_box.downloader.downloaders import download_model -from speech_box.elstimator.base import Elstimator -from speech_box.utils.model import create_model_dict +from vox_box.config.config import BackendEnum, Config, TaskTypeEnum +from vox_box.downloader.downloaders import download_model +from vox_box.elstimator.base import Elstimator +from vox_box.utils.model import create_model_dict logger = logging.getLogger(__name__) diff --git a/speech_box/logging.py b/vox_box/logging.py similarity index 100% rename from speech_box/logging.py rename to vox_box/logging.py diff --git a/speech_box/main.py b/vox_box/main.py similarity index 88% rename from speech_box/main.py rename to vox_box/main.py index d8b5492..90ba095 100644 --- a/speech_box/main.py +++ b/vox_box/main.py @@ -2,8 +2,8 @@ import signal import sys -from speech_box.cmd import setup_start_cmd -from speech_box.cmd.version import setup_version_cmd +from vox_box.cmd import setup_start_cmd +from vox_box.cmd.version import setup_version_cmd def handle_signal(sig, frame): diff --git a/speech_box/server/app.py b/vox_box/server/app.py similarity index 86% rename from speech_box/server/app.py rename to vox_box/server/app.py index f9eaddf..cd712d2 100644 --- a/speech_box/server/app.py +++ b/vox_box/server/app.py @@ -3,8 +3,8 @@ from fastapi.responses import JSONResponse import httpx -from speech_box import __version__ -from speech_box.server.routers import router +from vox_box import __version__ +from vox_box.server.routers import router @asynccontextmanager @@ -15,7 +15,7 @@ async def lifespan(app: FastAPI): app = FastAPI( - title="speech-box", + title="vox-box", lifespan=lifespan, response_model_exclude_unset=True, version=__version__, diff --git a/speech_box/server/model.py b/vox_box/server/model.py similarity index 80% rename from speech_box/server/model.py rename to vox_box/server/model.py index 376d26c..980523c 100644 --- a/speech_box/server/model.py +++ b/vox_box/server/model.py @@ -1,13 +1,13 @@ from typing import Union -from speech_box.backends.stt.base import STTBackend -from speech_box.backends.stt.faster_whisper import FasterWhisper -from speech_box.backends.stt.funasr import FunASR -from speech_box.backends.tts.bark import Bark -from speech_box.backends.tts.base import TTSBackend -from speech_box.backends.tts.cosyvoice import CosyVoice -from speech_box.config.config import BackendEnum, Config -from speech_box.downloader import downloaders -from speech_box.elstimator.estimate import estimate_model +from vox_box.backends.stt.base import STTBackend +from vox_box.backends.stt.faster_whisper import FasterWhisper +from vox_box.backends.stt.funasr import FunASR +from vox_box.backends.tts.bark import Bark +from vox_box.backends.tts.base import TTSBackend +from vox_box.backends.tts.cosyvoice import CosyVoice +from vox_box.config.config import BackendEnum, Config +from vox_box.downloader import downloaders +from vox_box.elstimator.estimate import estimate_model _instance = None diff --git a/speech_box/server/routers.py b/vox_box/server/routers.py similarity index 96% rename from speech_box/server/routers.py rename to vox_box/server/routers.py index f0fd413..b69d071 100644 --- a/speech_box/server/routers.py +++ b/vox_box/server/routers.py @@ -3,9 +3,9 @@ from pydantic import BaseModel from fastapi.responses import FileResponse -from speech_box.backends.stt.base import STTBackend -from speech_box.backends.tts.base import TTSBackend -from speech_box.server.model import get_model_instance +from vox_box.backends.stt.base import STTBackend +from vox_box.backends.tts.base import TTSBackend +from vox_box.server.model import get_model_instance from concurrent.futures import ThreadPoolExecutor router = APIRouter() diff --git a/speech_box/server/server.py b/vox_box/server/server.py similarity index 86% rename from speech_box/server/server.py rename to vox_box/server/server.py index ecd5a50..f260cb7 100644 --- a/speech_box/server/server.py +++ b/vox_box/server/server.py @@ -1,9 +1,9 @@ import logging -from speech_box.config.config import Config +from vox_box.config.config import Config import uvicorn -from speech_box.logging import setup_logging -from speech_box.server.app import app +from vox_box.logging import setup_logging +from vox_box.server.app import app logger = logging.getLogger(__name__) diff --git a/speech_box/utils/compat_importlib.py b/vox_box/utils/compat_importlib.py similarity index 100% rename from speech_box/utils/compat_importlib.py rename to vox_box/utils/compat_importlib.py diff --git a/speech_box/utils/ffmpeg.py b/vox_box/utils/ffmpeg.py similarity index 100% rename from speech_box/utils/ffmpeg.py rename to vox_box/utils/ffmpeg.py diff --git a/speech_box/utils/file.py b/vox_box/utils/file.py similarity index 100% rename from speech_box/utils/file.py rename to vox_box/utils/file.py diff --git a/speech_box/utils/log.py b/vox_box/utils/log.py similarity index 100% rename from speech_box/utils/log.py rename to vox_box/utils/log.py diff --git a/speech_box/utils/model.py b/vox_box/utils/model.py similarity index 81% rename from speech_box/utils/model.py rename to vox_box/utils/model.py index 2f6ba27..d2d472e 100644 --- a/speech_box/utils/model.py +++ b/vox_box/utils/model.py @@ -7,8 +7,8 @@ def create_model_dict(id: str, **kwargs) -> Dict: "id": id, "object": "model", "created": int(time.time()), - "owner": "speech-box", - "backend": "speech-box", + "owner": "vox-box", + "backend": "vox-box", } for k, v in kwargs.items():