mirror of
https://github.com/salesforce/BLIP.git
synced 2026-04-30 12:21:12 +00:00
update demo
This commit is contained in:
@@ -106,7 +106,10 @@
|
|||||||
"model = model.to(device)\n",
|
"model = model.to(device)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"with torch.no_grad():\n",
|
"with torch.no_grad():\n",
|
||||||
" caption = model.generate(image, sample=False, num_beams=3, max_length=20, min_length=5)\n",
|
" # beam search\n",
|
||||||
|
" caption = model.generate(image, sample=False, num_beams=3, max_length=20, min_length=5) \n",
|
||||||
|
" # nucleus sampling\n",
|
||||||
|
" # caption = model.generate(image, sample=True, top_p=0.9, max_length=20, min_length=5) \n",
|
||||||
" print('caption: '+caption[0])"
|
" print('caption: '+caption[0])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user