Image-Text-to-Text
MLX
Safetensors
mlx-vlm
nemotron
nemotron-h
mamba
Mixture of Experts
multimodal
computer-use
agent
conversational
Instructions to use abenzerps/Holotron4-30B-A3B-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use abenzerps/Holotron4-30B-A3B-MLX with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("abenzerps/Holotron4-30B-A3B-MLX") config = load_config("abenzerps/Holotron4-30B-A3B-MLX") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use abenzerps/Holotron4-30B-A3B-MLX with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "abenzerps/Holotron4-30B-A3B-MLX"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "abenzerps/Holotron4-30B-A3B-MLX" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use abenzerps/Holotron4-30B-A3B-MLX with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "abenzerps/Holotron4-30B-A3B-MLX"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default abenzerps/Holotron4-30B-A3B-MLX
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use abenzerps/Holotron4-30B-A3B-MLX with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "abenzerps/Holotron4-30B-A3B-MLX"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "abenzerps/Holotron4-30B-A3B-MLX" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Download Holotron4-30B-A3B-MLX-4bit/evs.py from abenzerps/Holotron4-30B-A3B-MLX: direct link, hf CLI and curl.
- Browser
- Download file 2.92 kB
-
https://huggingface.co/abenzerps/Holotron4-30B-A3B-MLX/resolve/main/Holotron4-30B-A3B-MLX-4bit/evs.py
- Command line
-
hf download hf://abenzerps/Holotron4-30B-A3B-MLX/Holotron4-30B-A3B-MLX-4bit/evs.py
-
curl -L -o evs.py https://huggingface.co/abenzerps/Holotron4-30B-A3B-MLX/resolve/main/Holotron4-30B-A3B-MLX-4bit/evs.py
2.92 kB
| import torch | |
| from typing import Tuple | |
| class EfficientVideoSampling: | |
| def compute_retention_mask( | |
| *, | |
| video_embeds: torch.FloatTensor, | |
| thw: torch.LongTensor, | |
| spatial_merge_size: int, | |
| q: float, | |
| ): | |
| """ | |
| Computes the retention mask for video embeddings based on the grid dimensions. | |
| Args: | |
| video_embeds (`torch.FloatTensor` of shape `(T * H * W, hidden_size)`): | |
| The video embeddings to compute the retention mask for. | |
| thw (`torch.LongTensor` of shape `(3)`): | |
| The temporal, height and width of feature shape of each video in LLM. | |
| spatial_merge_size (`int`): The spatial merge size of the video embeddings. | |
| If embeddings will be downsampled *later*, this should be the downsampling factor. | |
| q: (`float`): Pruning rate factor, indicating number of tokens to prune (remove) | |
| Returns: | |
| `torch.Tensor`: The retention mask for the video embeddings (T * H * W). | |
| 1 for tokens to keep, 0 for tokens to prune. | |
| """ | |
| T, H, W = thw | |
| # video_embeds = einops.rearrange( | |
| # video_embeds, | |
| # "(T H W) C -> T H W C", | |
| # T=T, | |
| # H=H // spatial_merge_size, | |
| # W=W // spatial_merge_size, | |
| # ) | |
| # Use reshape instead of einops to avoid graph breaks | |
| video_embeds = video_embeds.reshape( | |
| T, H // spatial_merge_size, W // spatial_merge_size, video_embeds.size(-1) | |
| ) | |
| # Core EVS | |
| similarity = torch.nn.functional.cosine_similarity( | |
| video_embeds[1:, ...], video_embeds[:-1, ...], dim=-1 | |
| ) | |
| dissimilarity = 1 - similarity | |
| # Always ensure we include all tokens from the first frame | |
| dissimilarity = torch.cat( | |
| [255 * torch.ones_like(video_embeds[:1, :, :, 0]), dissimilarity], dim=0 | |
| ) | |
| dissimilarity_flat = dissimilarity.view(-1) | |
| min_num_tokens = (H // spatial_merge_size) * (W // spatial_merge_size) # a single frame | |
| evs_num_tokens = int(T * min_num_tokens * (1 - q)) | |
| num_tokens_to_keep = max(min_num_tokens, evs_num_tokens) | |
| order = torch.argsort(dissimilarity_flat, | |
| dim=-1, | |
| descending=True, | |
| stable=True) | |
| topk_indices = order[:num_tokens_to_keep] | |
| retention_mask = torch.zeros_like(dissimilarity_flat, dtype=torch.bool) | |
| retention_mask[topk_indices] = True | |
| retention_mask = retention_mask.reshape(dissimilarity.size()) | |
| # print( | |
| # f"Computed retention mask of shape {retention_mask.shape=} with sparsity {retention_mask.float().mean().item():.4f} for {q=}", | |
| # ) | |
| mask = retention_mask.view(-1) # "T H W -> (T H W)" | |
| return mask | |