Views
No views yet

Like other large language models for which the diversity (or lack thereof) of training data induces downstream impact on the quality of our model, OPT-175B has limitations in terms of bias and safety. OPT-175B can also have quality issues in terms of generation diversity and hallucination. In general, OPT-175B is not immune from the plethora of issues that plague modern large language models.
| dtype | Largest Layer or Residual Group | Total Size | Training using Adam |
|---|---|---|---|
| float32 | 490.94 MB | 14.43 GB | 57.72 GB |
| float16/bfloat16 | 245.47 MB | 7.21 GB | 28.86 GB |
| int8 | 122.73 MB | 3.61 GB | 14.43 GB |
| int4 | 61.37 MB | 1.8 GB | 7.21 GB |
1import requests
2from PIL import Image
3from transformers import Blip2Processor, Blip2ForConditionalGeneration
4
5processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
6model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b")
7
8img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
9raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
10
11question = "how many dogs are in the picture?"
12inputs = processor(raw_image, question, return_tensors="pt")
13
14out = model.generate(**inputs)
15print(processor.decode(out[0], skip_special_tokens=True).strip())1# pip install accelerate
2import requests
3from PIL import Image
4from transformers import Blip2Processor, Blip2ForConditionalGeneration
5
6processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
7model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", device_map="auto")
8
9img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
10raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
11
12question = "how many dogs are in the picture?"
13inputs = processor(raw_image, question, return_tensors="pt").to("cuda")
14
15out = model.generate(**inputs)
16print(processor.decode(out[0], skip_special_tokens=True).strip())float16)1# pip install accelerate
2import torch
3import requests
4from PIL import Image
5from transformers import Blip2Processor, Blip2ForConditionalGeneration
6
7processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
8model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", torch_dtype=torch.float16, device_map="auto")
9
10img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
11raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
12
13question = "how many dogs are in the picture?"
14inputs = processor(raw_image, question, return_tensors="pt").to("cuda", torch.float16)
15
16out = model.generate(**inputs)
17print(processor.decode(out[0], skip_special_tokens=True).strip())int8)1# pip install accelerate bitsandbytes
2import torch
3import requests
4from PIL import Image
5from transformers import Blip2Processor, Blip2ForConditionalGeneration
6
7processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
8model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", load_in_8bit=True, device_map="auto")
9
10img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
11raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
12
13question = "how many dogs are in the picture?"
14inputs = processor(raw_image, question, return_tensors="pt").to("cuda", torch.float16)
15
16out = model.generate(**inputs)
17print(processor.decode(out[0], skip_special_tokens=True).strip())