Skip to content

Loading SenseVoice with FunASR crashe #289

@grihenrik

Description

@grihenrik

Loading SenseVoice with FunASR crashes with:

AttributeError: 'SinusoidalPositionEncoder' object has no attribute '_state_dict_pre_hooks'

This happens during model initialization (before inference finishes), and prevents transcription jobs from completing.

To Reproduce
Build and run SenseVoice service.
Install/run FunASR path that loads iic/SenseVoiceSmall.
Execute:
or in app context:

Observe crash trace:
Expected behavior
Model loads successfully and transcription runs normally.

Actual behavior
Model load fails with _state_dict_pre_hooks AttributeError in SinusoidalPositionEncoder.

Environment
SenseVoice model: iic/SenseVoiceSmall
Backend: FunASR (AutoModel)
Runtime: Python 3.11
PyTorch runtime observed: 2.4.1+cu121
Containerized deployment (Docker)
Additional context
The issue appears related to SinusoidalPositionEncoder.init not initializing torch.nn.Module state (missing super().init()), which leads to missing internal hook fields used by state_dict().

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions