Instructions to use kkatiz/THAI-BLIP-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kkatiz/THAI-BLIP-2 with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="kkatiz/THAI-BLIP-2")# Load model directly from transformers import AutoProcessor, AutoModelForVisualQuestionAnswering processor = AutoProcessor.from_pretrained("kkatiz/THAI-BLIP-2") model = AutoModelForVisualQuestionAnswering.from_pretrained("kkatiz/THAI-BLIP-2") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -18,8 +18,8 @@ base_model: Salesforce/blip2-opt-2.7b-coco
|
|
| 18 |
|
| 19 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 20 |
|
| 21 |
-
processor = Blip2Processor.from_pretrained("kkatiz/THAI-BLIP-2
|
| 22 |
-
model = Blip2ForConditionalGeneration.from_pretrained("kkatiz/THAI-BLIP-2
|
| 23 |
|
| 24 |
img = Image.open("Your image...")
|
| 25 |
inputs = processor(images=img, return_tensors="pt").to(device, torch.bfloat16)
|
|
|
|
| 18 |
|
| 19 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 20 |
|
| 21 |
+
processor = Blip2Processor.from_pretrained("kkatiz/THAI-BLIP-2")
|
| 22 |
+
model = Blip2ForConditionalGeneration.from_pretrained("kkatiz/THAI-BLIP-2", device_map=device, torch_dtype=torch.bfloat16)
|
| 23 |
|
| 24 |
img = Image.open("Your image...")
|
| 25 |
inputs = processor(images=img, return_tensors="pt").to(device, torch.bfloat16)
|