ahmedmbutt commited on
Commit
b3fe4f6
1 Parent(s): 2ecaf41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -227,7 +227,7 @@ def generate2(
227
  is_gpu = False
228
  device = CUDA(0) if is_gpu else "cpu"
229
  clip_model, preprocess = clip.load("ViT-B/32", device=device, jit=False)
230
- tokenizer = GPT2Tokenizer.from_pretrained("gpt2", revision="6c0e6080953db56375760c0471a8c5f2929baf11")
231
 
232
  def inference(img,model_name):
233
  prefix_length = 10
@@ -238,7 +238,7 @@ def inference(img,model_name):
238
  model_path = coco_weight
239
  else:
240
  model_path = conceptual_weight
241
- model.load_state_dict(torch.load(model_path, map_location=CPU))
242
  model = model.eval()
243
  device = CUDA(0) if is_gpu else "cpu"
244
  model = model.to(device)
 
227
  is_gpu = False
228
  device = CUDA(0) if is_gpu else "cpu"
229
  clip_model, preprocess = clip.load("ViT-B/32", device=device, jit=False)
230
+ tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
231
 
232
  def inference(img,model_name):
233
  prefix_length = 10
 
238
  model_path = coco_weight
239
  else:
240
  model_path = conceptual_weight
241
+ model.load_state_dict(torch.load(model_path, map_location=CPU), strict=False)
242
  model = model.eval()
243
  device = CUDA(0) if is_gpu else "cpu"
244
  model = model.to(device)