修复与优化 prepare_model_script.py - #3
Open
zhdbk3 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复镜像站无法下载的问题
os.environ['HF_ENDPOINT'] = endpoint实际上并无法被 huggingface_hub 正确识别,应改为在snapshot_download()里传递endpoint参数。/,否则在拼接 URL 时会再加一个/上去,造成出错。优化下载的文件
chinese-clip-vit-base-patch16 和 chinese-clip-vit-large-patch14 的仓库中有封装成两种格式的模型权重文件(pytorch_model.bin 和 xxx.pt),
snapshot_download()在下载模型时会把两个巨大的文件都下下来,造成整整一倍的时间、网络和存储空间的浪费。本项目只需要有 pytorch_model.bin 即可,所以应排除下载 xxx.pt(传入ignore_patterns='*.pt'参数)。移除 chinese-clip-rn50 选项
chinese-clip-rn50 仓库里只有 clip_cn_rn50.pt,没有 pytorch_model.bin,transformers 库用不了。
我目前是给它的选项注释掉了。
如果一定要用这个模型的话,得迁移到 cn_clip 库。