Instructions to use hkondle/CapstoneMainModel with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hkondle/CapstoneMainModel 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="hkondle/CapstoneMainModel")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("hkondle/CapstoneMainModel") model = AutoModelForMultimodalLM.from_pretrained("hkondle/CapstoneMainModel", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload the checkpoint that produces the good descriptions
Browse files- README.md +15 -2
- model.safetensors +1 -1
README.md
CHANGED
|
@@ -11,7 +11,20 @@ tags:
|
|
| 11 |
|
| 12 |
# VisAble diagram captioner
|
| 13 |
|
| 14 |
-
BLIP fine-tuned on AI2D-Caption
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
Trained for
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# VisAble diagram captioner
|
| 13 |
|
| 14 |
+
BLIP fine-tuned on AI2D-Caption diagrams to produce part-to-whole descriptions for blind and
|
| 15 |
+
low-vision students. The vision encoder was frozen and only the text decoder was trained, using a
|
| 16 |
+
cross entropy loss that up-weights AI2D entity labels by 5.0x.
|
| 17 |
|
| 18 |
+
Trained for 10 epochs, batch size 8, learning rate 5e-05.
|
| 19 |
|
| 20 |
+
```python
|
| 21 |
+
from transformers import BlipForConditionalGeneration, BlipProcessor
|
| 22 |
+
from PIL import Image
|
| 23 |
+
|
| 24 |
+
processor = BlipProcessor.from_pretrained("hkondle/CapstoneMainModel-10ep")
|
| 25 |
+
model = BlipForConditionalGeneration.from_pretrained("hkondle/CapstoneMainModel-10ep")
|
| 26 |
+
|
| 27 |
+
image = Image.open("diagram.png").convert("RGB")
|
| 28 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 29 |
+
print(processor.decode(model.generate(**inputs, max_length=256, num_beams=4)[0], skip_special_tokens=True))
|
| 30 |
+
```
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 989839224
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2c079de1c52f8650f54c7b368e66de66bd0d1cf0bab76b0087f6c409d7aea8c0
|
| 3 |
size 989839224
|