Commit
·
fcd98ee
1
Parent(s):
864ff4a
it mostly worked!
Browse files
app.py
CHANGED
|
@@ -3,6 +3,9 @@ from transformers import AutoProcessor, Blip2ForConditionalGeneration
|
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
# Load the BLIP-2 model and processor
|
| 7 |
processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
| 8 |
# Load model in int8 using bitsandbytes, and pass device_map='auto'
|
|
|
|
| 3 |
import torch
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
+
# Check for GPU availability and set the device variable accordingly
|
| 7 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 8 |
+
|
| 9 |
# Load the BLIP-2 model and processor
|
| 10 |
processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
| 11 |
# Load model in int8 using bitsandbytes, and pass device_map='auto'
|