Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
4 |
+
|
5 |
+
|
6 |
+
```python
|
7 |
+
import torch
|
8 |
+
from PIL import Image
|
9 |
+
from transformers import AutoModel, CLIPImageProcessor
|
10 |
+
|
11 |
+
model = AutoModel.from_pretrained(
|
12 |
+
'OpenGVLab/InternViT-6B-224px',
|
13 |
+
torch_dtype=torch.bfloat16,
|
14 |
+
low_cpu_mem_usage=True,
|
15 |
+
trust_remote_code=True).cuda().eval()
|
16 |
+
|
17 |
+
image = Image.open('./examples/image1.jpg').convert('RGB')
|
18 |
+
|
19 |
+
image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternViT-6B-224px')
|
20 |
+
|
21 |
+
pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
|
22 |
+
pixel_values = pixel_values.to(torch.bfloat16).cuda()
|
23 |
+
|
24 |
+
outputs = model(pixel_values)
|
25 |
+
```
|