Image-Text-to-Text
Transformers
English
vision-language-model
vlm
surveillance
iot
gemma
vl-jepa
multimodal
object-detection
video-analytics
Instructions to use hardiksa/arcisvlm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hardiksa/arcisvlm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hardiksa/arcisvlm")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("hardiksa/arcisvlm", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hardiksa/arcisvlm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hardiksa/arcisvlm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hardiksa/arcisvlm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hardiksa/arcisvlm
- SGLang
How to use hardiksa/arcisvlm with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "hardiksa/arcisvlm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hardiksa/arcisvlm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "hardiksa/arcisvlm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hardiksa/arcisvlm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hardiksa/arcisvlm with Docker Model Runner:
docker model run hf.co/hardiksa/arcisvlm
| """ | |
| Patch Embedding β converts images to sequences of patch tokens via Conv2d. | |
| Takes a 384Γ384 RGB image, splits into 16Γ16 patches β 576 patch tokens, each projected to hidden_dim. | |
| """ | |
| import torch | |
| import torch.nn as nn | |
| class PatchEmbedding(nn.Module): | |
| """ | |
| Convert image into patch embeddings using a single Conv2d. | |
| The Conv2d with kernel_size=patch_size and stride=patch_size efficiently | |
| splits the image into non-overlapping patches and projects each to hidden_dim. | |
| Args: | |
| img_size: Input image size (square) | |
| patch_size: Size of each patch (square) | |
| in_channels: Number of input channels (3 for RGB) | |
| hidden_dim: Embedding dimension for each patch | |
| """ | |
| def __init__(self, img_size: int = 448, patch_size: int = 16, in_channels: int = 3, hidden_dim: int = 768): | |
| super().__init__() | |
| assert img_size % patch_size == 0, f"img_size ({img_size}) must be divisible by patch_size ({patch_size})" | |
| self.img_size = img_size | |
| self.patch_size = patch_size | |
| self.num_patches = (img_size // patch_size) ** 2 # 576 for 384/16 | |
| self.hidden_dim = hidden_dim | |
| # Single Conv2d does both splitting and projection | |
| self.proj = nn.Conv2d( | |
| in_channels=in_channels, | |
| out_channels=hidden_dim, | |
| kernel_size=patch_size, | |
| stride=patch_size, | |
| ) | |
| def forward(self, x: torch.Tensor) -> torch.Tensor: | |
| """ | |
| Args: | |
| x: [batch, channels, img_size, img_size] β RGB image tensor | |
| Returns: | |
| [batch, num_patches, hidden_dim] β sequence of patch embeddings | |
| """ | |
| B, C, H, W = x.shape | |
| assert H == self.img_size and W == self.img_size, ( | |
| f"Input image size ({H}Γ{W}) doesn't match expected ({self.img_size}Γ{self.img_size})" | |
| ) | |
| # Conv2d: [B, 3, 384, 384] β [B, 768, 24, 24] | |
| x = self.proj(x) | |
| # Flatten spatial dims: [B, 768, 24, 24] β [B, 768, 576] β [B, 576, 768] | |
| x = x.flatten(2).transpose(1, 2) | |
| return x | |