Instructions to use princepride/MiniCPM-V-2_6-VPM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use princepride/MiniCPM-V-2_6-VPM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="princepride/MiniCPM-V-2_6-VPM", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("princepride/MiniCPM-V-2_6-VPM", trust_remote_code=True) model = AutoModel.from_pretrained("princepride/MiniCPM-V-2_6-VPM", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,9 +10,23 @@ tags: []
|
|
| 10 |
## Uses
|
| 11 |
|
| 12 |
|
| 13 |
-
from transformers import
|
| 14 |
import torch
|
|
|
|
|
|
|
| 15 |
model = AutoModel.from_pretrained('princepride/MiniCPM-V-2_6-VPM', trust_remote_code=True,
|
| 16 |
attn_implementation='flash_attention_2', torch_dtype=torch.bfloat16)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
model = model.eval().cuda()
|
| 18 |
|
|
|
|
| 10 |
## Uses
|
| 11 |
|
| 12 |
|
| 13 |
+
from transformers import AutoProcessor, AutoModel
|
| 14 |
import torch
|
| 15 |
+
from PIL import Image
|
| 16 |
+
|
| 17 |
model = AutoModel.from_pretrained('princepride/MiniCPM-V-2_6-VPM', trust_remote_code=True,
|
| 18 |
attn_implementation='flash_attention_2', torch_dtype=torch.bfloat16)
|
| 19 |
+
processor = AutoProcessor.from_pretrained('princepride/MiniCPM-V-2_6-VPM', trust_remote_code=True)
|
| 20 |
+
image = Image.open(r'workspace/00002-2654981627.png').convert('RGB')
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
inputs = processor(
|
| 24 |
+
[image],
|
| 25 |
+
max_slice_nums=max_slice_nums,
|
| 26 |
+
use_image_id=use_image_id,
|
| 27 |
+
return_tensors="pt",
|
| 28 |
+
max_length=max_inp_length
|
| 29 |
+
)
|
| 30 |
+
model(inputs)
|
| 31 |
model = model.eval().cuda()
|
| 32 |
|