0x5446 / api4sensevoice

API and websocket server for sensevoice. It has inherited some enhanced features, such as VAD detection, real-time streaming recognition, and speaker verification.
218 stars 32 forks source link

运行结果有问题 #12

Closed ArnoChenFx closed 1 month ago

ArnoChenFx commented 1 month ago

按照文档一步步配置环境都没什么问题,就是server返回的结果都是乱的。

image

以下是server的启动log

<unknown>:65: SyntaxWarning: invalid escape sequence '\['
<unknown>:124: SyntaxWarning: invalid escape sequence '\['
<unknown>:135: SyntaxWarning: invalid escape sequence '\['
<unknown>:256: SyntaxWarning: invalid escape sequence '\['
<unknown>:277: SyntaxWarning: invalid escape sequence '\['
<unknown>:300: SyntaxWarning: invalid escape sequence '\['
2024-10-10 01:53:45,632 - modelscope - INFO - Use user-specified model revision: v1.0.0
2024-10-10 01:53:45,970 - modelscope - INFO - initiate model from ~\.cache\modelscope\hub\iic\speech_eres2net_large_sv_zh-cn_3dspeaker_16k
2024-10-10 01:53:45,971 - modelscope - INFO - initiate model from location ~\.cache\modelscope\hub\iic\speech_eres2net_large_sv_zh-cn_3dspeaker_16k.
2024-10-10 01:53:46,343 - modelscope - WARNING - No preprocessor field found in cfg.
2024-10-10 01:53:46,343 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file.
2024-10-10 01:53:46,343 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': '~\\.cache\\modelscope\\hub\\iic\\speech_eres2net_large_sv_zh-cn_3dspeaker_16k'}. trying to build by task and model information.
2024-10-10 01:53:46,344 - modelscope - WARNING - No preprocessor key ('eres2net-sv', 'speaker-verification') found in PREPROCESSOR_MAP, skip building preprocessor.
2024-10-10 01:53:47,068 - modelscope - WARNING - Using branch: master as version is unstable, use with caution
2024-10-10 01:53:47,360 - modelscope - INFO - initiate model from ~\.cache\modelscope\hub\iic\SenseVoiceSmall
2024-10-10 01:53:47,360 - modelscope - INFO - initiate model from location ~\.cache\modelscope\hub\iic\SenseVoiceSmall.
2024-10-10 01:53:47,362 - modelscope - INFO - initialize model from ~\.cache\modelscope\hub\iic\SenseVoiceSmall
funasr version: 1.1.10.
~\.conda\envs\cleans2s\Lib\site-packages\funasr\train_utils\load_pretrained_model.py:39: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  ori_state = torch.load(path, map_location=map_location)
2024-10-10 01:53:49,190 - modelscope - WARNING - No preprocessor field found in cfg.
2024-10-10 01:53:49,190 - modelscope - WARNING - No val key and type key found in preprocessor domain of configuration.json file.
2024-10-10 01:53:49,190 - modelscope - WARNING - Cannot find available config to build preprocessor at mode inference, current config: {'model_dir': '~\\.cache\\modelscope\\hub\\iic\\SenseVoiceSmall'}. trying to build by task and model information.

2024-10-10 01:53:49,190 - modelscope - WARNING - No preprocessor key ('funasr', 'auto-speech-recognition') found in PREPROCESSOR_MAP, skip building preprocessor.
funasr version: 1.1.10.
2024-10-10 01:53:49,433 - modelscope - WARNING - Using branch: master as version is unstable, use with caution
Loading remote code successfully: ./model.py
funasr version: 1.1.10.
2024-10-10 01:53:51,388 - modelscope - INFO - Use user-specified model revision: v2.0.4
INFO:     Started server process [28936]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:27000 (Press CTRL+C to quit)
ArnoChenFx commented 1 month ago

找到原因了,client_wss.html中sampleRate没有传给AudioContext. 正确写法如下:

new AudioContext({sampleRate: inputSampleRate});