FireRedASR
FireRedASR copied to clipboard
限定torch版本
在使用torch==2.6.0的时候,运行inference_fireredasr_aed.sh 会报错,需要稍微降低一下版本
Traceback (most recent call last):
File "/home/orange/FireRedASR/examples/fireredasr/speech2text.py", line 105, in <module>
main(args)
File "/home/orange/FireRedASR/examples/fireredasr/speech2text.py", line 43, in main
model = FireRedAsr.from_pretrained(args.asr_type, args.model_dir)
File "/home/orange/FireRedASR/examples/fireredasr/models/fireredasr.py", line 25, in from_pretrained
model = load_fireredasr_aed_model(model_path)
File "/home/orange/FireRedASR/examples/fireredasr/models/fireredasr.py", line 110, in load_fireredasr_aed_model
package = torch.load(model_path, map_location=lambda storage, loc: storage)
File "/home/orange/anaconda3/envs/fireredasr/lib/python3.10/site-packages/torch/serialization.py", line 1470, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) In PyTorch 2.6, we changed the default value of the `weights_only` argument in `torch.load` from `False` to `True`. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
(2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL argparse.Namespace was not an allowed global by default. Please use `torch.serialization.add_safe_globals([Namespace])` or the `torch.serialization.safe_globals([Namespace])` context manager to allowlist this global if you trust this class/function.
Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.
设置 weights_only=False就可以了
Thanks for your pull request!
感谢PR。累积一段时间我们会统一处理,再次感谢。
vim fireredasr/models/fireredasr.py
TypeError: Unpickler.init() got an unexpected keyword argument 'weight_only' 出现新的错误