作为一个小白,今天在看Salesforce/blip-image-captioning-large时发现模型有
model.safetensors
pytorch_model.bin
tf_model.h5
于是见检索了下,做下笔记
权重格式选择:
优先使用 model.safetensors(加载更快、更安全)。
若环境不支持 safetensors,则用 pytorch_model.bin。
若使用 TensorFlow 推理,需保留 tf_model.h5 并替换 model.safetensors。
safetensors 需要安装 pip install safetensors
pytorch_model.bin 需要安装 pip install torch torchvision torchaudio transformers
tf_model.h5 需要安装 pip install tensorflow