gokaygokay
commited on
Commit
•
6525661
1
Parent(s):
452ccc6
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -1,3 +1,39 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
pipeline_tag: image-text-to-text
|
4 |
---
|
5 |
+
|
6 |
+
moondream2 is a small vision language model designed to run efficiently on edge devices. Check out the [GitHub repository](https://github.com/vikhyat/moondream) for details, or try it out on the [Hugging Face Space](https://huggingface.co/spaces/vikhyatk/moondream2)!
|
7 |
+
|
8 |
+
**Benchmarks**
|
9 |
+
|
10 |
+
| Release | VQAv2 | GQA | TextVQA | TallyQA (simple) | TallyQA (full) |
|
11 |
+
| --- | --- | --- | --- | --- | --- |
|
12 |
+
| 2024-03-04 | 74.2 | 58.5 | 36.4 | - | - |
|
13 |
+
| 2024-03-06 | 75.4 | 59.8 | 43.1 | 79.5 | 73.2 |
|
14 |
+
| **2024-03-13** (latest) | 76.8 | 60.6 | 46.4 | 79.6 | 73.3 |
|
15 |
+
|
16 |
+
**Usage**
|
17 |
+
|
18 |
+
```bash
|
19 |
+
pip install transformers timm einops
|
20 |
+
```
|
21 |
+
|
22 |
+
```python
|
23 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
24 |
+
from PIL import Image
|
25 |
+
|
26 |
+
model_id = "vikhyatk/moondream2"
|
27 |
+
revision = "2024-03-06"
|
28 |
+
model = AutoModelForCausalLM.from_pretrained(
|
29 |
+
model_id, trust_remote_code=True, revision=revision
|
30 |
+
)
|
31 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)
|
32 |
+
|
33 |
+
image = Image.open('<IMAGE_PATH>')
|
34 |
+
enc_image = model.encode_image(image)
|
35 |
+
print(model.answer_question(enc_image, "Describe this image.", tokenizer))
|
36 |
+
```
|
37 |
+
|
38 |
+
The model is updated regularly, so we recommend pinning the model version to a
|
39 |
+
specific release as shown above.
|