Image-Text-to-Text
Safetensors
MLX
mlx-vlm
mistral3
apple-silicon
pixtral
guardrail
content-moderation
safety-classification
multimodal
4-bit precision
conversational
Instructions to use AXONVERTEX-AI-RESEARCH/Shieldstral-1.0-3B-MLX-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use AXONVERTEX-AI-RESEARCH/Shieldstral-1.0-3B-MLX-4bit 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("AXONVERTEX-AI-RESEARCH/Shieldstral-1.0-3B-MLX-4bit") config = load_config("AXONVERTEX-AI-RESEARCH/Shieldstral-1.0-3B-MLX-4bit") # 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
File size: 1,187 Bytes
4dc5bc6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
[[ "$(uname -s)" == "Darwin" ]] || { echo "ERROR: MLX requires macOS." >&2; exit 1; }
[[ "$(uname -m)" == "arm64" ]] || { echo "ERROR: MLX requires Apple Silicon arm64." >&2; exit 1; }
[[ -f .venv/bin/activate ]] || { echo "ERROR: Run ./scripts/install.sh first." >&2; exit 1; }
source .venv/bin/activate
MODEL_DIR="${MODEL_DIR:-$ROOT}"
HOST="${HOST:-127.0.0.1}"
PORT="${PORT:-18190}"
MAX_KV_SIZE="${MAX_KV_SIZE:-16384}"
KV_BITS="${KV_BITS:-8}"
TOP_LOGPROBS_K="${TOP_LOGPROBS_K:-20}"
[[ -f "$MODEL_DIR/model.safetensors" ]] || { echo "ERROR: model.safetensors missing from $MODEL_DIR" >&2; exit 1; }
[[ ! -f "$MODEL_DIR/tekken.json" ]] || { echo "ERROR: tekken.json must not be present in this MLX runtime artifact." >&2; exit 1; }
echo "Model: $MODEL_DIR"
echo "Endpoint: http://$HOST:$PORT/v1"
echo "Context cap: $MAX_KV_SIZE; KV cache: ${KV_BITS}-bit"
exec mlx_vlm.server \
--model "$MODEL_DIR" \
--host "$HOST" \
--port "$PORT" \
--top-logprobs-k "$TOP_LOGPROBS_K" \
--max-kv-size "$MAX_KV_SIZE" \
--kv-bits "$KV_BITS" \
--kv-group-size 64 \
--trust-remote-code
|