Nowkim commited on
Commit
98af8ad
·
verified ·
1 Parent(s): 34d57c7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -1
README.md CHANGED
@@ -34,6 +34,7 @@ tokenizer = open_clip.get_tokenizer("ViT-L-14")
34
  import torch
35
  import open_clip
36
  from safetensors.torch import load_file
 
37
  from PIL import Image
38
 
39
  model_name = "ViT-L-14"
@@ -44,7 +45,14 @@ model, _, preprocess = open_clip.create_model_and_transforms(
44
  pretrained=None,
45
  )
46
 
47
- state_dict = load_file("open_clip_pytorch_model.safetensors")
 
 
 
 
 
 
 
48
  model.load_state_dict(state_dict, strict=True)
49
  model = model.to(device)
50
  model.eval()
 
34
  import torch
35
  import open_clip
36
  from safetensors.torch import load_file
37
+ from huggingface_hub import hf_hub_download
38
  from PIL import Image
39
 
40
  model_name = "ViT-L-14"
 
45
  pretrained=None,
46
  )
47
 
48
+ repo_id = "Yale-BIDS-Chen/medpmc-clip-l-14_jun24_v1"
49
+
50
+ ckpt_path = hf_hub_download(
51
+ repo_id=repo_id,
52
+ filename="open_clip_pytorch_model.safetensors",
53
+ )
54
+
55
+ state_dict = load_file(ckpt_path, device="cpu")
56
  model.load_state_dict(state_dict, strict=True)
57
  model = model.to(device)
58
  model.eval()