Image Segmentation
Transformers
Safetensors
English
prima
text-generation
computer-vision
multi-image-reasoning
pixel-grounding
vision-language
custom-code
custom_code
Instructions to use kanguyen-vn/PRIMA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kanguyen-vn/PRIMA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="kanguyen-vn/PRIMA", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("kanguyen-vn/PRIMA", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 455 Bytes
91c1e9e | 1 2 3 4 5 6 7 8 9 10 11 12 | """Map the model's native/explicit grounding slots to ordered input images."""
def image_mask_slots(pred_masks, num_images):
if pred_masks is None:
return [None] * num_images
if len(pred_masks) == num_images + 1:
pred_masks = pred_masks[1:]
if len(pred_masks) != num_images:
raise ValueError('Grounding output does not match the number of input images.')
return [slot[0] if slot else None for slot in pred_masks]
|