Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: "3.10"
cache: "pip"

- uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # v1.6.0
with:
Expand All @@ -33,26 +32,37 @@ jobs:
git fetch origin ${{ github.ref }}
git checkout FETCH_HEAD

- name: Install everyvoice
run: |
cd EveryVoice
CUDA_TAG=cpu pip install -r requirements.torch.txt --find-links https://download.pytorch.org/whl/torch_stable.html
pip install -e .[dev]
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
# Install a specific version of uv.
version: "0.11.8"

- run: pip freeze
- name: Install the project
run: |
cd EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightning/
uv sync --locked --all-extras --dev
uv pip install --editable ../../../..

- run: pip list
- run: |
cd EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightning/
uv pip freeze
- run: |
cd EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightning/
uv pip list

- name: Run fs2 unit tests
run: |
cd EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightning/
coverage run -m pytest
coverage xml
uv run coverage run -m pytest
uv run coverage xml
env:
PYTHONPATH: ${{ github.workspace }}/EveryVoice

- name: Plain text coverage report
run: |
cd EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightning/
coverage report
uv run coverage report

- uses: codecov/codecov-action@v5
with:
Expand Down
37 changes: 11 additions & 26 deletions fs2/prediction_writing_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import numpy.typing as npt
import torch
import torchaudio
from everyvoice.base_cli.prediction_writing_callback import (
BasePredictionWritingCallback,
)
from everyvoice.model.feature_prediction.FastSpeech2_lightning.fs2.utils import (
truncate_basename,
)
Expand Down Expand Up @@ -114,7 +117,7 @@ def get_synthesis_output_callbacks(
return callbacks


class PredictionWritingCallbackBase(Callback):
class PredictionWritingCallbackBase(BasePredictionWritingCallback):
def __init__(
self,
config: FastSpeech2Config,
Expand All @@ -123,31 +126,13 @@ def __init__(
save_dir: Path,
include_global_step_in_filename: bool = False,
) -> None:
super().__init__()
super().__init__(
save_dir=save_dir,
file_extension=file_extension,
global_step=global_step,
include_global_step_in_filename=include_global_step_in_filename,
)
self.config = config
self.file_extension = file_extension
self.global_step = f"ckpt={global_step}"
self.save_dir = save_dir
self.sep = "--"
self.include_global_step_in_filename = include_global_step_in_filename

self.save_dir.mkdir(parents=True, exist_ok=True)

def get_filename(
self,
basename: str,
speaker: str,
language: str,
) -> str:
# We don't truncate or alter the filename here because the basename is
# already truncated/cleaned in cli/synthesize.py
name_parts = [basename, speaker, language, self.file_extension]
if self.include_global_step_in_filename:
name_parts.insert(-1, self.global_step)
path = self.save_dir / self.sep.join(name_parts)
# synthesizing spec allows nested outputs so we may need to make subdirs
path.parent.mkdir(parents=True, exist_ok=True)
return str(path)


class ScorerCallback(Callback):
Expand Down Expand Up @@ -662,7 +647,7 @@ def __init__(
self.output_hop_size = (
sampling_rate_change * vocoder_config.preprocessing.audio.fft_hop_size
)
self.file_extension = self.sep.join(
self.file_extension: str = self.sep.join(
(f"v_ckpt={vocoder_global_step}", self.file_extension)
)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dynamic = ["version"]
description = "Text-to-Speech Synthesis for the Speech Generation for Indigenous Language Education Small Teams Project"
license = "MIT"
readme = "readme.md"
requires-python = ">=3.10"
requires-python = ">=3.10, <3.13"
authors = [
{ name = "Aidan Pine", email = "hello@aidanpine.ca" },
{ name = "Samuel Larkin", email = "Samuel.Larkin@nrc-cnrc.gc.ca" },
Expand Down
Loading
Loading