diff --git a/.gitignore b/.gitignore index ac2496a..89f6de2 100644 --- a/.gitignore +++ b/.gitignore @@ -103,7 +103,7 @@ celerybeat.pid # Environments .env -.venv +tools/venv env/ venv/ ENV/ @@ -127,7 +127,7 @@ dmypy.json # Pyre type checker .pyre/ - +*.lock exp/ downloads/ data/ diff --git a/README.md b/README.md index 18cd502..4d06114 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ You can use the `_id` argument to specify which pre-trained model to use. If not > Since SHEET is a on-going project, if you use our pre-trained model in you paper, it is suggested to specify the version. For instance: `SHEET SSL-MOS v0.1.0`, `SHEET SSL-MOS v0.2.5`, etc. > [!TIP] -> You don't need to install sheet following the [installation instructions](#instsallation). However, you might need to install the following: +> You don't need to install sheet following the [installation instructions](#installation). However, you might need to install the following: > ``` > sheet-sqa > huggingface_hub @@ -63,18 +63,18 @@ You can use the `_id` argument to specify which pre-trained model to use. If not 1.5806346 ``` -## Instsallation +## installation Full installation is needed if your goal is to do **training**. ### Editable installation with virtualenv -You don't need to prepare an environment (using conda, etc.) first. The following commands will automatically construct a virtual environment in `tools/`. When you run the recipes, the scripts will automatically activate the virtual environment. +First install the uv package manager [here](https://docs.astral.sh/uv/getting-started/installation/). Then, use the following commands to automatically construct a virtual environment in `tools/venv`. When you run the recipes, the scripts will automatically activate the virtual environment. ```bash git clone https://github.com/unilight/sheet.git -cd sheet/tools -make +cd sheet +bash install.sh train ``` ## Information diff --git a/egs/bvcc/path.sh b/egs/bvcc/path.sh index 9ddc626..4069294 100755 --- a/egs/bvcc/path.sh +++ b/egs/bvcc/path.sh @@ -6,7 +6,7 @@ if [ -e "${PRJ_ROOT}/tools/venv/bin/activate" ]; then fi MAIN_ROOT=$PWD/../.. -export PATH=$MAIN_ROOT/sheet/bin:$PATH +export PATH=$MAIN_ROOT/src/sheet/bin:$PATH # python related export OMP_NUM_THREADS=1 diff --git a/hubconf.py b/hubconf.py index c02a9b7..48507b6 100644 --- a/hubconf.py +++ b/hubconf.py @@ -6,7 +6,7 @@ """torch.hub configuration.""" dependencies = ["yaml", "torch", "torchaudio", "sheet", "huggingface_hub"] - +import sys import os import torch import torch.nn.functional as F @@ -14,6 +14,11 @@ import yaml from huggingface_hub import hf_hub_download +repo_root = os.path.dirname(os.path.abspath(__file__)) +src_path = os.path.join(repo_root, "src") +if src_path not in sys.path: + sys.path.insert(0, 0, src_path) + FS = 16000 resamplers = {} MIN_REQUIRED_WAV_LENGTH = 1040 diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..c4f5580 --- /dev/null +++ b/install.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +uv venv tools/venv +source tools/venv/bin/activate + +if [[ "$1" == "train" ]]; then + echo "Including 'train' extras..." + uv sync --extra train --active +else + echo "Syncing without 'train' extras..." + uv sync --active +fi \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fed528d..f61dc76 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,43 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools>=61", "wheel"] build-backend = "setuptools.build_meta" + +[project] +name = "sheet" +version = "0.2.5" +description = "Speech Human Evaluation Estimation Toolkit (SHEET)" +requires-python = "==3.10.13" + +authors = [ + { name = "Wen-Chin Huang", email = "wen.chinhuang@g.sp.m.is.nagoya-u.ac.jp" } +] + +dependencies = [ + "torch==2.0.1", + "torchaudio==2.0.2", + "numpy==1.26.4", + "h5py>=3.15.1", + "pyyaml>=6.0.3", + "transformers>=4.57.1", + "scipy>=1.15.3", + "soundfile>=0.13.1", + "soxr>=1.0.0", + "wheel>=0.45.1", + "s3prl>=0.4.18", +] + +[project.optional-dependencies] +train = [ + "matplotlib>=3.10.7", + "tqdm>=4.67.1", + "gdown", + "tensorboardx>=2.6.4", + "kaldiio>=2.14.1", + "humanfriendly>=10.0", + "prettytable>=3.16.0", +] + +[tool.setuptools] +packages = [ + "sheet" +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100755 index 99c581a..0000000 --- a/setup.cfg +++ /dev/null @@ -1,41 +0,0 @@ -[options] -packages = find: -install_requires = - librosa >= 0.8.0 - soundfile>=0.10.2 - pyyaml - h5py>=2.9.0 - filelock - protobuf<=3.20.1 - scipy - s3prl - faiss-cpu - -[options.extras_require] -train = - matplotlib>=3.1.0 - tqdm>=4.26.1 - gdown - tensorboardX - kaldiio>=2.14.1 - humanfriendly - prettytable - -[metadata] -name = sheet_sqa -version = 0.2.5 -author = Wen-Chin Huang -author_email = wen.chinhuang@g.sp.m.is.nagoya-u.ac.jp -description = Speech Human Evaluation Estimation Toolkit (SHEET) -keywords = speech quality assessment -license = MIT -url = https://github.com/unilight/sheet -project_urls = - Source = https://github.com/unilight/sheet - Tracker = https://github.com/unilight/sheet/issues -long_description=README.md -long_description_content_type=text/markdown -classifiers = - License :: OSI Approved :: MIT License - Programming Language :: Python :: 3 - diff --git a/sheet/models/utmos.py b/sheet/models/utmos.py index b0facb3..44f7672 100644 --- a/sheet/models/utmos.py +++ b/sheet/models/utmos.py @@ -43,6 +43,7 @@ def __init__( decoder_activation: str = "ReLU", output_type: str = "scalar", range_clipping: bool = True, + num_domains: int = None, ): super().__init__() # this is needed! or else there will be an error. self.use_mean_listener = use_mean_listener