iamrobotbear commited on
Commit
bd67535
·
1 Parent(s): 33f9417

switch back to opt-2.7b

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -7,12 +7,7 @@ from PIL import Image
7
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
8
 
9
 
10
- # Load the BLIP-2 model and processor (needs A10G)
11
- processor = AutoProcessor.from_pretrained("Salesforce/blip-itm-large-coco")
12
- # Load model in int8 using bitsandbytes, and pass device_map='auto'
13
- model = Blip2ForConditionalGeneration.from_pretrained(
14
- "Salesforce/blip-itm-large-coco", load_in_8bit=True, device_map='auto'
15
- )
16
 
17
 
18
  # Load the BLIP-2 model and processor (needs A10G)
@@ -22,14 +17,14 @@ model = Blip2ForConditionalGeneration.from_pretrained(
22
  # "Salesforce/blip2-opt-6.7b-coco", load_in_8bit=True, device_map='auto'
23
  #)
24
 
25
- # Uncomment lines 20, 22, 23, & 24 to begin using blip2-oopt-2.7b model (can run on T4 Medium)
26
 
27
  # Load the BLIP-2 model and processor
28
- #processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
29
  # Load model in int8 using bitsandbytes, and pass device_map='auto'
30
- #model = Blip2ForConditionalGeneration.from_pretrained(
31
- # "Salesforce/blip2-opt-2.7b", load_in_8bit=True, device_map='auto'
32
- #)
33
 
34
  def blip2_interface(image, prompted_caption_text, vqa_question, chat_context):
35
  # Prepare image input
 
7
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
8
 
9
 
10
+
 
 
 
 
 
11
 
12
 
13
  # Load the BLIP-2 model and processor (needs A10G)
 
17
  # "Salesforce/blip2-opt-6.7b-coco", load_in_8bit=True, device_map='auto'
18
  #)
19
 
20
+ # Uncomment lines 20, 22, 23, & 24 to begin using blip2-opt-2.7b model (can run on T4 Medium)
21
 
22
  # Load the BLIP-2 model and processor
23
+ processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
24
  # Load model in int8 using bitsandbytes, and pass device_map='auto'
25
+ model = Blip2ForConditionalGeneration.from_pretrained(
26
+ "Salesforce/blip2-opt-2.7b", load_in_8bit=True, device_map='auto'
27
+ )
28
 
29
  def blip2_interface(image, prompted_caption_text, vqa_question, chat_context):
30
  # Prepare image input