Skip to main content

A Qwen3-based forced alignment plugin for the cjm-transcription-plugin-system that provides word-level audio-text alignment using Qwen/Qwen3-ForcedAligner-0.6B with progress reporting.

Project description

cjm-transcription-plugin-qwen3-forced-aligner

Install

pip install cjm_transcription_plugin_qwen3_forced_aligner

Project Structure

nbs/
├── meta.ipynb   # Metadata introspection for the Qwen3 Forced Aligner plugin used by cjm-ctl to generate the registration manifest.
└── plugin.ipynb # Plugin implementation for Qwen3 word-level forced alignment

Total: 2 notebooks

Module Dependencies

graph LR
    meta[meta<br/>Metadata]
    plugin[plugin<br/>Qwen3 Forced Aligner Plugin]

    plugin --> meta

1 cross-module dependencies detected

CLI Reference

No CLI commands found in this project.

Module Overview

Detailed documentation for each module in the project:

Metadata (meta.ipynb)

Metadata introspection for the Qwen3 Forced Aligner plugin used by cjm-ctl to generate the registration manifest.

Import

from cjm_transcription_plugin_qwen3_forced_aligner.meta import (
    get_plugin_metadata
)

Functions

def get_plugin_metadata() -> Dict[str, Any]:  # Plugin metadata for manifest generation
    """Return metadata required to register this plugin with the PluginManager."""
    # Fallback base path (current behavior for backward compatibility)
    base_path = os.path.dirname(os.path.dirname(sys.executable))

    # Use CJM config if available, else fallback to env-relative paths
    cjm_data_dir = os.environ.get("CJM_DATA_DIR")
    cjm_models_dir = os.environ.get("CJM_MODELS_DIR")

    # Plugin data directory
    plugin_name = "cjm-transcription-plugin-qwen3-forced-aligner"
    if cjm_data_dir
    "Return metadata required to register this plugin with the PluginManager."

Qwen3 Forced Aligner Plugin (plugin.ipynb)

Plugin implementation for Qwen3 word-level forced alignment

Import

from cjm_transcription_plugin_qwen3_forced_aligner.plugin import (
    Qwen3ForcedAlignerConfig,
    Qwen3ForcedAlignerPlugin
)

Classes

@dataclass
class Qwen3ForcedAlignerConfig:
    "Configuration for the Qwen3 Forced Aligner plugin."
    
    model_id: str = field(...)
    device: str = field(...)
    dtype: str = field(...)
    attn_implementation: str = field(...)
    language: str = field(...)
class Qwen3ForcedAlignerPlugin:
    def __init__(self):
        """Initialize the plugin with default state."""
        self.logger = logging.getLogger(f"{__name__}.{type(self).__name__}")
        self._config: Qwen3ForcedAlignerConfig = None
    "Qwen3 Forced Alignment plugin for word-level audio-text alignment."
    
    def __init__(self):
            """Initialize the plugin with default state."""
            self.logger = logging.getLogger(f"{__name__}.{type(self).__name__}")
            self._config: Qwen3ForcedAlignerConfig = None
        "Initialize the plugin with default state."
    
    def name(self) -> str:  # Plugin name identifier
            return "cjm-transcription-plugin-qwen3-forced-aligner"
    
        @property
        def version(self) -> str:  # Plugin version string
    
    def version(self) -> str:  # Plugin version string
            return "0.0.1"
    
        @property
        def supported_formats(self) -> List[str]:  # Supported audio file formats
    
    def supported_formats(self) -> List[str]:  # Supported audio file formats
            return ["wav", "mp3", "flac", "ogg", "m4a"]
    
        def is_available(self) -> bool:  # True if qwen_asr is importable
    
    def is_available(self) -> bool:  # True if qwen_asr is importable
            """Check if the Qwen3 forced aligner is available."""
            return QWEN3_AVAILABLE
    
        def get_config_schema(self) -> Dict[str, Any]:  # JSON Schema for configuration
        "Check if the Qwen3 forced aligner is available."
    
    def get_config_schema(self) -> Dict[str, Any]:  # JSON Schema for configuration
            """Return JSON Schema for UI generation."""
            return dataclass_to_jsonschema(Qwen3ForcedAlignerConfig)
    
        def get_current_config(self) -> Dict[str, Any]:  # Current configuration as dictionary
        "Return JSON Schema for UI generation."
    
    def get_current_config(self) -> Dict[str, Any]:  # Current configuration as dictionary
            """Return current configuration state."""
            if not self._config
        "Return current configuration state."
    
    def initialize(
            self,
            config: Optional[Any] = None  # Configuration dataclass, dict, or None
        ) -> None
        "Initialize or re-configure the plugin (idempotent)."
    
    def execute(
            self,
            audio: Union[AudioData, str, Path],  # Audio data or file path
            text: str,                            # Transcript text to align against
            **kwargs
        ) -> ForcedAlignResult:  # Word-level alignment result
        "Perform forced alignment of text against audio."
    
    def cleanup(self) -> None
        "Clean up resources."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file cjm_transcription_plugin_qwen3_forced_aligner-0.0.1.tar.gz.

File metadata

File hashes

Hashes for cjm_transcription_plugin_qwen3_forced_aligner-0.0.1.tar.gz
Algorithm Hash digest
SHA256 632cb98af79846b4b66083cea94983d424491f68c7bc78d8b6a889fec048c420
MD5 ca89a1f3e5d771ae506c37eef1728b9a
BLAKE2b-256 be90e0592be191528d5e9d48b32b608d50870ea46a60073cbd7d97d1037ba29a

See more details on using hashes here.

File details

Details for the file cjm_transcription_plugin_qwen3_forced_aligner-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cjm_transcription_plugin_qwen3_forced_aligner-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7116f28d8f36c8e18a4bb9e73cc85bf29d039fc34d21226feee80cdf93337dc8
MD5 d6c6f4205a1b6045cdbf9e4c165cd259
BLAKE2b-256 3aac31e4403498bdf64cce22dcb26047d894b90b192f13c92a5afcf05fca0ade

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page