BleachNick commited on
Commit
8862295
1 Parent(s): 078d257

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -12
README.md CHANGED
@@ -8,7 +8,7 @@ library_name: transformers
8
  # Model Card for MMICL
9
 
10
  ## Temporal Demo for MMICL
11
- [Playground for MMICL-FLANT5XXL](https://ddb87ac77b2611b779.gradio.live/)
12
  support multi-image input as well as video input.
13
  <!-- Provide a quick summary of what the model is/does. -->
14
 
@@ -53,16 +53,12 @@ import json
53
  import transformers
54
  from PIL import Image
55
  import torch
56
- from model.blip2 import Blip2Processor,Blip2ForConditionalGeneration
57
- from model.blip2 import Blip2Config
58
  model_type="instructblip"
59
  model_ckpt="BleachNick/MMICL-Instructblip-T5-xxl"
 
 
60
 
61
- if 'blip2' in model_type:
62
- model = Blip2ForConditionalGeneration.from_pretrained(
63
- model_ckpt,
64
- config=config).to('cuda:0',dtype=torch.bfloat16)
65
- elif 'instructblip' in model_type:
66
  model = InstructBlipForConditionalGeneration.from_pretrained(
67
  model_ckpt,
68
  config=config).to('cuda:0',dtype=torch.bfloat16)
@@ -73,16 +69,14 @@ sp = ["图"]+[f"<image{i}>" for i in range(20)]
73
  processor = InstructBlipProcessor.from_pretrained(
74
  model_ckpt
75
  )
76
- # processor = Blip2Processor.from_pretrained(
77
- # model_ckpt
78
- # )
79
 
80
  sp = sp+processor.tokenizer.additional_special_tokens[len(sp):]
81
  processor.tokenizer.add_special_tokens({'additional_special_tokens':sp})
82
 
83
 
84
  prompt = ['Use the image 0: <image0>图,image 1: <image1>图 and image 2: <image2>图 as a visual aid to help you calculate the equation accurately. image 0 is 2+1=3.\nimage 1 is 5+6=11.\nimage 2 is"']
85
-
86
  prompt = " ".join(prompt)
87
 
88
  inputs = processor(images=images, text=prompt, return_tensors="pt")
 
8
  # Model Card for MMICL
9
 
10
  ## Temporal Demo for MMICL
11
+ [Playground for MMICL-FLANT5XXL](https://bcd7bc41d42486e7c8.gradio.live/)
12
  support multi-image input as well as video input.
13
  <!-- Provide a quick summary of what the model is/does. -->
14
 
 
53
  import transformers
54
  from PIL import Image
55
  import torch
 
 
56
  model_type="instructblip"
57
  model_ckpt="BleachNick/MMICL-Instructblip-T5-xxl"
58
+ config_ckpt = "Salesforce/instructblip-flan-t5-xxl"
59
+ config = InstructBlipConfig.from_pretrained(config_ckpt )
60
 
61
+ if 'instructblip' in model_type:
 
 
 
 
62
  model = InstructBlipForConditionalGeneration.from_pretrained(
63
  model_ckpt,
64
  config=config).to('cuda:0',dtype=torch.bfloat16)
 
69
  processor = InstructBlipProcessor.from_pretrained(
70
  model_ckpt
71
  )
72
+
 
 
73
 
74
  sp = sp+processor.tokenizer.additional_special_tokens[len(sp):]
75
  processor.tokenizer.add_special_tokens({'additional_special_tokens':sp})
76
 
77
 
78
  prompt = ['Use the image 0: <image0>图,image 1: <image1>图 and image 2: <image2>图 as a visual aid to help you calculate the equation accurately. image 0 is 2+1=3.\nimage 1 is 5+6=11.\nimage 2 is"']
79
+ # images try to load the images to be a list of PIL.Image object.
80
  prompt = " ".join(prompt)
81
 
82
  inputs = processor(images=images, text=prompt, return_tensors="pt")