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
| """ | |
| Selective Decoding — smart decode triggering for streaming video. | |
| For 1000+ cameras, we can't decode every frame. The JEPA predictor runs continuously | |
| producing embeddings, but the MoE decoder is only invoked when a semantic shift | |
| is detected — i.e., when something meaningfully changes in the scene. | |
| This reduces decoding operations by ~2.85x for stationary scenes while never | |
| missing important events. | |
| Algorithm: | |
| 1. Maintain a running embedding for each camera stream | |
| 2. Compare new frame embedding with previous using cosine similarity | |
| 3. If similarity < threshold → semantic shift → trigger decode | |
| 4. Optionally: agglomerative clustering for temporal segmentation | |
| """ | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| from collections import defaultdict | |
| class SelectiveDecoder: | |
| """ | |
| Monitors embedding streams and triggers decoding only on semantic shifts. | |
| Maintains per-camera state tracking the last decoded embedding. | |
| When a new frame's embedding differs significantly, triggers full decoding. | |
| Args: | |
| similarity_threshold: Cosine similarity below which we decode (0.95 = very sensitive) | |
| min_decode_interval: Minimum seconds between decodes per camera | |
| embed_dim: Embedding dimension (1536) | |
| """ | |
| def __init__( | |
| self, | |
| similarity_threshold: float = 0.95, | |
| min_decode_interval: float = 1.0, | |
| embed_dim: int = 1536, | |
| ): | |
| self.similarity_threshold = similarity_threshold | |
| self.min_decode_interval = min_decode_interval | |
| self.embed_dim = embed_dim | |
| # Per-camera state: last decoded embedding and timestamp | |
| self._last_embeddings: dict[str, torch.Tensor] = {} | |
| self._last_decode_times: dict[str, float] = {} | |
| # Statistics | |
| self._total_frames = 0 | |
| self._decoded_frames = 0 | |
| def should_decode( | |
| self, | |
| camera_id: str, | |
| embedding: torch.Tensor, | |
| timestamp: float, | |
| ) -> bool: | |
| """ | |
| Determine if this frame should trigger MoE decoding. | |
| Args: | |
| camera_id: Unique camera identifier | |
| embedding: [embed_dim] — predicted embedding for this frame | |
| timestamp: Current timestamp in seconds | |
| Returns: | |
| True if decoder should be invoked | |
| """ | |
| self._total_frames += 1 | |
| # Always decode first frame from a camera | |
| if camera_id not in self._last_embeddings: | |
| self._last_embeddings[camera_id] = embedding.detach() | |
| self._last_decode_times[camera_id] = timestamp | |
| self._decoded_frames += 1 | |
| return True | |
| # Check minimum interval | |
| time_since_last = timestamp - self._last_decode_times[camera_id] | |
| if time_since_last < self.min_decode_interval: | |
| return False | |
| # Compute cosine similarity with last decoded embedding | |
| last_embed = self._last_embeddings[camera_id] | |
| similarity = F.cosine_similarity( | |
| embedding.unsqueeze(0), | |
| last_embed.unsqueeze(0), | |
| ).item() | |
| # Semantic shift detected | |
| if similarity < self.similarity_threshold: | |
| self._last_embeddings[camera_id] = embedding.detach() | |
| self._last_decode_times[camera_id] = timestamp | |
| self._decoded_frames += 1 | |
| return True | |
| return False | |
| def force_decode(self, camera_id: str, embedding: torch.Tensor, timestamp: float) -> None: | |
| """Force update state (e.g., for user-initiated VQA queries).""" | |
| self._last_embeddings[camera_id] = embedding.detach() | |
| self._last_decode_times[camera_id] = timestamp | |
| self._decoded_frames += 1 | |
| def batch_should_decode( | |
| self, | |
| camera_ids: list[str], | |
| embeddings: torch.Tensor, | |
| timestamps: list[float], | |
| ) -> list[bool]: | |
| """ | |
| Batch version for multiple cameras. | |
| Args: | |
| camera_ids: List of camera IDs | |
| embeddings: [num_cameras, embed_dim] | |
| timestamps: List of timestamps | |
| Returns: | |
| List of booleans indicating which cameras should decode | |
| """ | |
| results = [] | |
| for i, (cam_id, timestamp) in enumerate(zip(camera_ids, timestamps)): | |
| results.append(self.should_decode(cam_id, embeddings[i], timestamp)) | |
| return results | |
| def decode_ratio(self) -> float: | |
| """Fraction of frames that triggered decoding.""" | |
| if self._total_frames == 0: | |
| return 0.0 | |
| return self._decoded_frames / self._total_frames | |
| def compression_ratio(self) -> float: | |
| """How much compute we saved (higher = more savings).""" | |
| if self._decoded_frames == 0: | |
| return float("inf") | |
| return self._total_frames / self._decoded_frames | |
| def reset_stats(self) -> None: | |
| """Reset statistics counters.""" | |
| self._total_frames = 0 | |
| self._decoded_frames = 0 | |
| def reset_camera(self, camera_id: str) -> None: | |
| """Reset state for a specific camera.""" | |
| self._last_embeddings.pop(camera_id, None) | |
| self._last_decode_times.pop(camera_id, None) | |
| def reset_all(self) -> None: | |
| """Reset all state.""" | |
| self._last_embeddings.clear() | |
| self._last_decode_times.clear() | |
| self.reset_stats() | |