Xinsheng-Wang's picture
Upload folder using huggingface_hub
6f869a0 verified
"""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")