FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

FunASRNano is not registered

Open sandsc opened this issue 11 months ago • 12 comments

version: funasr 1.2.9

Use local downloaded Fun-ASR-Nano-2512 model.

 assert model_class is not None, f'{kwargs["model"]} is not registered'
           │                           └ {'model': 'FunASRNano', 'model_conf': {'lsm_weight': 0.1, 'length_normalized_loss': True}, 'audio_encoder': 'SenseVoiceEncode...
           └ None

AssertionError: FunASRNano is not registered

Seems that FunASRNano is not auto registered.

And FunASRNano in model.py don't support ndarray as input. Other models like sensevoice, paramformer support numpy array as input. This caused inconsistent inputs to the AutoModel generate function.

for data in data_in:
            if isinstance(data, str):
                new_data_in.append(
                    [
                        {"role": "system", "content": "You are a helpful assistant."},
                        {
                            "role": "user",
                            "content": f"语音转写:<|startofspeech|>!{data}<|endofspeech|>",
                        },
                        {"role": "assistant", "content": "null"},
                    ]
                )
            elif isinstance(data, torch.Tensor):
                new_data_in.append(
                    [
                        {"role": "system", "content": "You are a helpful assistant."},
                        {
                            "role": "user",
                            "content": f"语音转写:<|startofspeech|>!!<|endofspeech|>",
                            "audio": data,
                        },
                        {"role": "assistant", "content": "null"},
                    ]
                )
        data_in = new_data_in

sandsc avatar Dec 16 '25 04:12 sandsc

+1 In the meantime, any workaround to get started with FunASRNano?

ryanwong00 avatar Dec 16 '25 09:12 ryanwong00

+1 In the meantime, any workaround to get started with FunASRNano?

FunASRNano is not registered bug can be solved by importing FunASRNano from funasr.models.fun_asr_nano.model import FunASRNano manually.

sandsc avatar Dec 16 '25 10:12 sandsc

Image

yimuu avatar Dec 16 '25 11:12 yimuu

+1 In the meantime, any workaround to get started with FunASRNano?

FunASRNano is not registered bug can be solved by importing FunASRNano from funasr.models.fun_asr_nano.model import FunASRNano manually.

Thanks a lot. You saved my day.

Just a side note, after importing FunASRNano, I ran into a problem of missing model.safetensors problem. It is noticed that the model.safetensors is not in the directory of Qwen3-0.6B, I downloaded the file from official Qwen3-0.6B and it is working now.

ryanwong00 avatar Dec 17 '25 02:12 ryanwong00

Image

Thanks a lot!

ryanwong00 avatar Dec 17 '25 02:12 ryanwong00

Thanks! I encountered this same problem today, and your method fixed it.

It makes sense that they extracted Qwen3-0.6B to keep the models separate and avoid duplication. However, the usage instructions really should clarify that users need to download Qwen3-0.6B manually.

fengin avatar Dec 17 '25 09:12 fengin

version: funasr 1.2.9

Use local downloaded Fun-ASR-Nano-2512 model.

 assert model_class is not None, f'{kwargs["model"]} is not registered'
           │                           └ {'model': 'FunASRNano', 'model_conf': {'lsm_weight': 0.1, 'length_normalized_loss': True}, 'audio_encoder': 'SenseVoiceEncode...
           └ None

AssertionError: FunASRNano is not registered

Seems that FunASRNano is not auto registered.

And FunASRNano in model.py don't support ndarray as input. Other models like sensevoice, paramformer support numpy array as input. This caused inconsistent inputs to the AutoModel generate function.

for data in data_in: if isinstance(data, str): new_data_in.append( [ {"role": "system", "content": "You are a helpful assistant."}, { "role": "user", "content": f"语音转写:<|startofspeech|>!{data}<|endofspeech|>", }, {"role": "assistant", "content": "null"}, ] ) elif isinstance(data, torch.Tensor): new_data_in.append( [ {"role": "system", "content": "You are a helpful assistant."}, { "role": "user", "content": f"语音转写:<|startofspeech|>!!<|endofspeech|>", "audio": data, }, {"role": "assistant", "content": "null"}, ] ) data_in = new_data_in

将你的ndarray转换成torch.Tensor即可。

` audio_np = np.frombuffer(audio_in, dtype=np.int16).astype(np.float32)

audio_tensor = torch.from_numpy(audio_np).unsqueeze(0).to(args.device)

audio_tensor = audio_tensor.float() / 32768.0 `

chengzhen123 avatar Dec 23 '25 02:12 chengzhen123

@chengzhen123

args.device 这里的args怎么定义的?

surfincanoy avatar Jan 08 '26 10:01 surfincanoy

同样的错误,啥时候会修复呢

sugarlesss avatar Feb 15 '26 15:02 sugarlesss

试一下这个方法,手动注册FunASRNano from funasr.models.fun_asr_nano.model import FunASRNano from funasr.register import tables tables.model_classes["FunASRNano"] = FunASRNano from funasr import AutoModel

Tianhyang avatar Mar 26 '26 06:03 Tianhyang

https://github.com/FunAudioLLM/Fun-ASR 这个项目下有个 model.py 复制到你当前目录,

trust_remote_code=True,
remote_code="./model.py",

加上这两个参数,

res = model.generate(
  #input=path 改
  input=[path]
  #batch_size_s=60, 改
  batch_size=1,

WT-0213 avatar May 15 '26 02:05 WT-0213

同 #2794 的解决方案:从源码安装最新版 pip install git+https://github.com/modelscope/FunASR.git,并确保安装了 tiktoken 和 huggingface_hub。

LauraGPT avatar May 19 '26 14:05 LauraGPT