Spaces:
Running
on
Zero
Running
on
Zero
File size: 2,223 Bytes
c7f3ffb 6f869a0 c7f3ffb 6f869a0 c7f3ffb 6f869a0 c7f3ffb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
"""Preprocess tools.
This package provides a thin, stable import surface for common preprocess components.
Examples:
from preprocess.tools import (
F0Extractor,
PitchExtractor,
VocalDetectionModel,
VocalSeparationModel,
VocalExtractionModel,
NoteTranscriptionModel,
LyricTranscriptionModel,
)
Note:
Keep these imports lightweight. If a tool pulls heavy dependencies at import time,
consider switching to lazy imports.
"""
from __future__ import annotations
# Core tools
from .f0_extraction import F0Extractor
from .vocal_detection import VocalDetector
# Some tools may live outside this package in different layouts across branches.
# Keep the public surface stable while avoiding hard import failures.
try:
from .vocal_separation.model import VocalSeparator # type: ignore
except Exception as e: # pragma: no cover
import sys
print(f"Warning: Failed to import VocalSeparator: {e}", file=sys.stderr)
import traceback
traceback.print_exc(file=sys.stderr)
VocalSeparator = None # type: ignore
try:
from .note_transcription.model import NoteTranscriber # type: ignore
except Exception as e: # pragma: no cover
import sys
import traceback
print("=" * 80, file=sys.stderr, flush=True)
print("ERROR: Failed to import NoteTranscriber", file=sys.stderr, flush=True)
print(f"Exception: {type(e).__name__}: {e}", file=sys.stderr, flush=True)
print("Full traceback:", file=sys.stderr, flush=True)
traceback.print_exc(file=sys.stderr)
print("=" * 80, file=sys.stderr, flush=True)
NoteTranscriber = None # type: ignore
try:
from .lyric_transcription import LyricTranscriber
except Exception as e: # pragma: no cover
import sys
print(f"Warning: Failed to import LyricTranscriber: {e}", file=sys.stderr)
import traceback
traceback.print_exc(file=sys.stderr)
LyricTranscriber = None # type: ignore
__all__ = [
"F0Extractor",
"VocalDetector",
]
if VocalSeparator is not None:
__all__.append("VocalSeparator")
if LyricTranscriber is not None:
__all__.append("LyricTranscriber")
if NoteTranscriber is not None:
__all__.append("NoteTranscriber")
|