| | --- |
| | library_name: transformers |
| | tags: [] |
| | --- |
| | |
| | # Model Card for Model ID |
| |
|
| | <!-- Provide a quick summary of what the model is/does. --> |
| |
|
| | ## Uses |
| |
|
| |
|
| | from transformers import AutoProcessor, AutoModel |
| | import torch |
| | from PIL import Image |
| | |
| | model = AutoModel.from_pretrained('princepride/MiniCPM-V-2_6-VPM', trust_remote_code=True, |
| | attn_implementation='flash_attention_2', torch_dtype=torch.bfloat16) |
| | processor = AutoProcessor.from_pretrained('princepride/MiniCPM-V-2_6-VPM', trust_remote_code=True) |
| | image = Image.open(r'workspace/00002-2654981627.png').convert('RGB') |
| | |
| | |
| | inputs = processor( |
| | [image], |
| | max_slice_nums=max_slice_nums, |
| | use_image_id=use_image_id, |
| | return_tensors="pt", |
| | max_length=max_inp_length |
| | ) |
| | model(inputs) |
| | model = model.eval().cuda() |
| | |
| |
|