mirror of
https://github.com/openai/CLIP.git
synced 2026-11-05 01:37:26 +00:00
[GH-ISSUE #205] 反馈一个BUG #178
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openai/CLIP#178
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ninding on GitHub (Jan 4, 2022).
Original GitHub issue: https://github.com/openai/CLIP/issues/205
@haofanwang commented on GitHub (Jan 4, 2022):
当前版本已经是正确的了。
github.com/openai/CLIP@573315e83f/clip/clip.py (L132)@ninding commented on GitHub (Jan 5, 2022):
如果我使用
state_dict = torch.load(model_path, map_location="cpu")
报错信息
Traceback (most recent call last):
File "/Users/zhangjiuding/Desktop/CLIP/test1.py", line 8, in
model, preprocess = clip.load('/Users/zhangjiuding/Desktop/CLIP/clip/model/model1.pkl', device)
File "/Users/zhangjiuding/Desktop/CLIP/clip/clip.py", line 138, in load
model = build_model(state_dict or model.state_dict()).to(device)
File "/Users/zhangjiuding/Desktop/CLIP/clip/model.py", line 400, in build_model
vit = "visual.proj" in state_dict
TypeError: argument of type 'CLIP' is not iterable
如果我使用
model = torch.load(model_path, map_location="cpu")
state_dict = None
不报错
@haofanwang commented on GitHub (Jan 5, 2022):
这应该是你模型保存的问题,你是怎么训练然后保存的?
@ninding commented on GitHub (Jan 5, 2022):
@haofanwang commented on GitHub (Jan 5, 2022):
加载的时候,不要使用
clip.load(),直接使用torch.load()。