mamba-minimal
mamba-minimal copied to clipboard
AttributeError: 'NoneType' object has no attribute 'seek'. You can only torch.load from a file that is seekable
Hello.
Error 'AttributeError:' NoneType 'object has no attribute' seek '. You can only torch. load from a file that is searchable. Please pre load the data into a buffer like io.BytesIO and try to load from it install.'.
I have assigned weights and the file path is also correct. I don't know how to solve it. May I ask for your advice
The same question.
我已经解决了。就是配置了hugging face的镜像,就能自己成功了。
(1) pip install -U huggingface_hub
(2)将 huggingface_hub下的constants.py里的ENDPOINT改成镜像
https://hf-mirror.com
我也解决了,感谢
是用我说的方法解决的吗
对的,不知道为什么他这个代码用下到本地的model不可以,必须用镜像下载
下载到本地的模型也可以,要修改一下代码。 这个错误的直接原因是Mamba类里from_pretrained方法中的load_state_dict_hf函数里,使用的cached_file(model_name, WEIGHTS_NAME),这里的WEIGHTS_NAME通常是'pytorch_model.bin',表示保存和加载模型权重的默认文件名。但是下载到本地的模型提供的权重文件是'model.safetensors',所以要用safetensors库中的torch.load_file加载:
加载完了之后,不知道为什么权重跟结构对不上,要稍微修改一下,在return model之前:
可以的!楼上方法可行!