Image Segmentation
Transformers
PyTorch
pixdlm
cvpr-2026
compute-transparency
reasoning-segmentation
uav
remote-sensing
vision-language
Instructions to use WhynotHug/PixDLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WhynotHug/PixDLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="WhynotHug/PixDLM")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("WhynotHug/PixDLM", dtype="auto") - Notebooks
- Google Colab
- Kaggle
| import torch | |
| IMAGE_TOKEN_INDEX = -200 | |
| DEFAULT_IMAGE_TOKEN = "<image>" | |
| def tokenizer_image_token( | |
| prompt, tokenizer, image_token_index=IMAGE_TOKEN_INDEX, return_tensors=None | |
| ): | |
| prompt_chunks = [ | |
| tokenizer(chunk).input_ids for chunk in prompt.split(DEFAULT_IMAGE_TOKEN) | |
| ] | |
| def insert_separator(items, separator): | |
| return [ | |
| element | |
| for pair in zip(items, [separator] * len(items)) | |
| for element in pair | |
| ][:-1] | |
| input_ids = [] | |
| offset = 0 | |
| if ( | |
| len(prompt_chunks) > 0 | |
| and len(prompt_chunks[0]) > 0 | |
| and prompt_chunks[0][0] == tokenizer.bos_token_id | |
| ): | |
| offset = 1 | |
| input_ids.append(prompt_chunks[0][0]) | |
| for chunk in insert_separator(prompt_chunks, [image_token_index] * (offset + 1)): | |
| input_ids.extend(chunk[offset:]) | |
| if return_tensors is not None: | |
| if return_tensors == "pt": | |
| return torch.tensor(input_ids, dtype=torch.long) | |
| raise ValueError(f"Unsupported tensor type: {return_tensors}") | |
| return input_ids | |