Run this model with HF Jobs
Run ukisai/Swift-Inkling-2-Mini-MLX-bf16 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ukisai/Swift-Inkling-2-Mini-MLX-bf16. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ukisai/Swift-Inkling-2-Mini-MLX-bf16 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/ukisai/Swift-Inkling-2-Mini-MLX-bf16. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use ukisai/Swift-Inkling-2-Mini-MLX-bf16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use ukisai/Swift-Inkling-2-Mini-MLX-bf16 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("ukisai/Swift-Inkling-2-Mini-MLX-bf16") config = load_config("ukisai/Swift-Inkling-2-Mini-MLX-bf16") # 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 ukisai/Swift-Inkling-2-Mini-MLX-bf16 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "ukisai/Swift-Inkling-2-Mini-MLX-bf16"
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": "ukisai/Swift-Inkling-2-Mini-MLX-bf16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use ukisai/Swift-Inkling-2-Mini-MLX-bf16 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 "ukisai/Swift-Inkling-2-Mini-MLX-bf16"
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 ukisai/Swift-Inkling-2-Mini-MLX-bf16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use ukisai/Swift-Inkling-2-Mini-MLX-bf16 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "ukisai/Swift-Inkling-2-Mini-MLX-bf16"
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 "ukisai/Swift-Inkling-2-Mini-MLX-bf16" \ --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 inkling2_processor.py from ukisai/Swift-Inkling-2-Mini-MLX-bf16: direct link, hf CLI and curl.
- Browser
- Download file 3.24 kB
-
https://huggingface.co/ukisai/Swift-Inkling-2-Mini-MLX-bf16/resolve/main/inkling2_processor.py
- Command line
-
hf download hf://ukisai/Swift-Inkling-2-Mini-MLX-bf16/inkling2_processor.py
-
curl -L -o inkling2_processor.py https://huggingface.co/ukisai/Swift-Inkling-2-Mini-MLX-bf16/resolve/main/inkling2_processor.py
3.24 kB
| # Copyright © 2026 Apple Inc. | |
| """Image processor of Inkling 2.""" | |
| import math | |
| from dataclasses import dataclass | |
| from typing import BinaryIO, ClassVar, Sequence | |
| import mlx.core as mx | |
| import numpy as np | |
| __all__ = [ | |
| "IMAGE_TOKEN", | |
| "Processor", | |
| ] | |
| IMAGE_TOKEN = "<|unused_200054|>" | |
| def _composite_alpha(rgba: np.ndarray) -> np.ndarray: | |
| height, width, _ = rgba.shape | |
| y, x = np.ogrid[:height, :width] | |
| background = np.where((x // 8 + y // 8) % 2 == 0, 204, 153)[..., None] | |
| rgb, alpha = rgba[..., :3].astype(np.int32), rgba[..., 3:].astype(np.int32) | |
| blended = (rgb * alpha + background * (255 - alpha) + 127) // 255 | |
| return blended.astype(np.uint8) | |
| class Processor: | |
| image_token: ClassVar[str] = IMAGE_TOKEN | |
| block_size: int = 40 | |
| image_mean: tuple[float, float, float] = (0.5, 0.5, 0.5) | |
| image_std: tuple[float, float, float] = (0.5, 0.5, 0.5) | |
| def from_config(cls, config: dict) -> "Processor": | |
| vision = config.get("vision_config") | |
| if not vision: | |
| raise ValueError("The model config has no vision_config.") | |
| patch_size = vision.get("native_patch_size", 20) | |
| merge_size = vision.get("adapter_merge_size", 2) | |
| return cls(block_size=patch_size * merge_size) | |
| def load_image(self, fp: str | BinaryIO) -> np.ndarray: | |
| """A uint8 (H, W, 3) image. As the reference, transparent pixels are | |
| put on a gray checkerboard.""" | |
| from PIL import Image | |
| with Image.open(fp) as image: | |
| if not image.has_transparency_data: | |
| return np.asarray(image.convert("RGB")) | |
| rgba = np.asarray(image.convert("RGBA")) | |
| return _composite_alpha(rgba) | |
| def preprocess_image(self, image: np.ndarray) -> tuple[mx.array, int]: | |
| assert image.ndim == 3 and image.shape[-1] == 3, "Images must be (H, W, 3)." | |
| assert image.dtype == np.uint8, "Images must be uint8." | |
| height, width, _ = image.shape | |
| rows = math.ceil(height / self.block_size) | |
| cols = math.ceil(width / self.block_size) | |
| # As the reference, the padding is -1 on the 0-255 scale. | |
| x = np.full( | |
| (rows * self.block_size, cols * self.block_size, 3), -1.0, np.float32 | |
| ) | |
| x[:height, :width] = image | |
| mean = np.array(self.image_mean, dtype=np.float32) | |
| std = np.array(self.image_std, dtype=np.float32) | |
| x = (x * np.float32(1 / 255) - mean) / std | |
| return mx.array(x.transpose(2, 0, 1)), rows * cols | |
| def __call__( | |
| self, text: str, *, images: Sequence[np.ndarray] | |
| ) -> tuple[str, dict[str, list[mx.array]]]: | |
| parts = text.split(IMAGE_TOKEN) | |
| if len(parts) - 1 != len(images): | |
| raise ValueError( | |
| f"The text has {len(parts) - 1} {IMAGE_TOKEN} " | |
| f"for {len(images)} images." | |
| ) | |
| pixel_values = [] | |
| expanded = [parts[0]] | |
| for image, part in zip(images, parts[1:], strict=True): | |
| pixels, num_tokens = self.preprocess_image(image) | |
| expanded += [IMAGE_TOKEN * num_tokens, part] | |
| pixel_values.append(pixels) | |
| return "".join(expanded), {"pixel_values": pixel_values} | |