Skip to content

Merge alpha: review fixes (SPARC, SQUIM, PPG, SpeechBrain, test names)#471

Merged
satra merged 1 commit into
mainfrom
alpha
Apr 25, 2026
Merged

Merge alpha: review fixes (SPARC, SQUIM, PPG, SpeechBrain, test names)#471
satra merged 1 commit into
mainfrom
alpha

Conversation

@satra

@satra satra commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

SPARC tempdir fix, SQUIM loop opt, public PPG API, SpeechBrain YAML parsing, test name discovery fix.

* Address review comments: SPARC tempdir, SQUIM loop, public PPG API, SB 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>

* Fix SpeechBrain YAML parsing: use permissive loader for custom tags

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>

* Fix test function names: add missing underscore after 'test' prefix

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>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@satra
satra merged commit 5cc1ff6 into main Apr 25, 2026
12 checks passed

@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 refactors SpeechBrain model loading to use a permissive YAML loader, makes PPG utility functions public, and fixes an issue in SPARC feature extraction where Audio objects relied on temporary files. It also optimizes model device placement in Torchaudio-Squim, though feedback suggests this may cause race conditions by modifying a global model instance.

raise ValueError("Only 16000 Hz sampling rate is supported by Torchaudio-Squim model.")

features: List[Dict[str, Any]] = []
model = _get_objective_model().to(device.value)

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.

medium

Moving the model to the device outside the loop is a good optimization. However, since _get_objective_model() returns a global model instance, calling .to(device.value) will modify the device of that global instance. In a multi-threaded environment where different threads might call this function with different devices, this could lead to race conditions and unexpected behavior as the model is moved back and forth between devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant