Skip to content

Address review comments: SPARC, SQUIM, PPG, SpeechBrain#470

Merged
satra merged 3 commits into
alphafrom
fix/review-comments-batch
Apr 25, 2026
Merged

Address review comments: SPARC, SQUIM, PPG, SpeechBrain#470
satra merged 3 commits into
alphafrom
fix/review-comments-batch

Conversation

@satra

@satra satra commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Addresses Gemini code review comments from PRs #463, #466, #468, #469.

Fixes

  • SPARC decode/convert: Audio created from waveform tensor directly — no dangling filepath to deleted tempdir
  • SQUIM: Model .to(device) moved before loop (was per-iteration)
  • PPG: extract_ppg_segments and to_frame_major_posteriorgram made public (tutorials were using private _ variants)
  • SpeechBrain SER: Cache key includes revision, hf_hub_download uses revision, YAML parsing with yaml.safe_load instead of fragile string splitting

All tests pass (10 PPG + full pre-commit).

🤖 Generated with Claude Code

Version

Published prerelease version: 1.3.1-alpha.16

Changelog

🐛 Bug Fix

  • Address review comments: SPARC, SQUIM, PPG, SpeechBrain #470 (@satra)

Authors: 1

…B revision

- SPARC decode/convert: create Audio from waveform tensor directly,
  no dangling filepath to deleted tempdir
- SQUIM: move model.to(device) before loop (was inside loop)
- PPG: rename _extract_ppg_segments → extract_ppg_segments (public),
  _to_frame_major_posteriorgram → to_frame_major_posteriorgram (public),
  export from __init__.py, update tutorials and tests
- SpeechBrain SER: add revision to cache key, pass revision to
  hf_hub_download, use yaml.safe_load instead of string splitting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@satra satra added the test-tutorials Run tutorial notebooks in CI (CPU and GPU) label Apr 25, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several enhancements and bug fixes across the audio processing tasks. Key updates include adding model revision support and safe YAML parsing for SpeechBrain SER, making PPG utility functions public, and fixing a bug in SPARC feature extraction where Audio objects were incorrectly linked to temporary file paths. Additionally, Torchaudio-Squim feature extraction was optimized by moving model loading outside the processing loop. However, a significant issue was identified in the test suite: several test functions were renamed without an underscore after the test prefix, which will prevent pytest from discovering and running them.


def test_to_frame_major_posteriorgram_3d() -> None:
"""Test _to_frame_major_posteriorgram with a (1, phonemes, frames) input."""
def testto_frame_major_posteriorgram_3d() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The test function name is missing an underscore after the test prefix. This will prevent pytest from discovering and running this test by default.

Suggested change
def testto_frame_major_posteriorgram_3d() -> None:
def test_to_frame_major_posteriorgram_3d() -> None:


def test_to_frame_major_posteriorgram_2d() -> None:
"""Test _to_frame_major_posteriorgram with a (phonemes, frames) input."""
def testto_frame_major_posteriorgram_2d() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The test function name is missing an underscore after the test prefix. This will prevent pytest from discovering and running this test by default.

Suggested change
def testto_frame_major_posteriorgram_2d() -> None:
def test_to_frame_major_posteriorgram_2d() -> None:


def test_to_frame_major_posteriorgram_already_frame_major() -> None:
"""Test _to_frame_major_posteriorgram when input is already (frames, phonemes)."""
def testto_frame_major_posteriorgram_already_frame_major() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The test function name is missing an underscore after the test prefix. This will prevent pytest from discovering and running this test by default.

Suggested change
def testto_frame_major_posteriorgram_already_frame_major() -> None:
def test_to_frame_major_posteriorgram_already_frame_major() -> None:



def test_to_frame_major_posteriorgram_too_few_dims() -> None:
def testto_frame_major_posteriorgram_too_few_dims() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The test function name is missing an underscore after the test prefix. This will prevent pytest from discovering and running this test by default.

Suggested change
def testto_frame_major_posteriorgram_too_few_dims() -> None:
def test_to_frame_major_posteriorgram_too_few_dims() -> None:



def test_extract_ppg_segments_basic() -> None:
def testextract_ppg_segments_basic() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The test function name is missing an underscore after the test prefix. This will prevent pytest from discovering and running this test by default.

Suggested change
def testextract_ppg_segments_basic() -> None:
def test_extract_ppg_segments_basic() -> None:



def test_extract_ppg_segments_single_phoneme() -> None:
def testextract_ppg_segments_single_phoneme() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The test function name is missing an underscore after the test prefix. This will prevent pytest from discovering and running this test by default.

Suggested change
def testextract_ppg_segments_single_phoneme() -> None:
def test_extract_ppg_segments_single_phoneme() -> None:



def test_extract_ppg_segments_empty() -> None:
def testextract_ppg_segments_empty() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The test function name is missing an underscore after the test prefix. This will prevent pytest from discovering and running this test by default.

Suggested change
def testextract_ppg_segments_empty() -> None:
def test_extract_ppg_segments_empty() -> None:

satra and others added 2 commits April 24, 2026 20:50
SpeechBrain hyperparams.yaml uses custom YAML tags (!new:, !ref, etc.)
that yaml.safe_load cannot handle. Use a dedicated SafeLoader subclass
with a multi-constructor that ignores unknown tags.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7 test functions were named testXxx instead of test_Xxx, making
them invisible to pytest discovery. Now all 14 PPG/segment tests
are properly discovered and pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@satra
satra merged commit c9ea141 into alpha Apr 25, 2026
7 checks passed
@satra
satra deleted the fix/review-comments-batch branch April 25, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-tutorials Run tutorial notebooks in CI (CPU and GPU)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant