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
| #!/usr/bin/env python3 | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import os | |
| from shieldstral_policy import ( | |
| discover_model, | |
| flatten_taxonomy, | |
| load_taxonomy, | |
| node_result, | |
| query_for, | |
| score_policy, | |
| ) | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description="Score one Shieldstral hierarchy policy node.") | |
| parser.add_argument("--node", required=True, help="Official SC/CAT ID or AXONVERTEX SUB ID") | |
| parser.add_argument("--document", required=True) | |
| parser.add_argument("--document-type", choices=("prompt", "response"), default="prompt") | |
| parser.add_argument("--instruct", default="Evaluate whether the document matches the query criteria") | |
| parser.add_argument("--threshold", type=float, default=0.5) | |
| parser.add_argument("--base-url", default=os.getenv("BASE_URL", "http://127.0.0.1:18190/v1")) | |
| parser.add_argument("--model", default=None) | |
| parser.add_argument("--taxonomy", default=None) | |
| parser.add_argument("--raw", action="store_true") | |
| args = parser.parse_args() | |
| taxonomy = load_taxonomy(args.taxonomy) | |
| nodes = flatten_taxonomy(taxonomy) | |
| node_id = args.node.upper() | |
| if node_id not in nodes: | |
| raise SystemExit(f"Unknown node ID: {node_id}") | |
| node = nodes[node_id] | |
| model = discover_model(args.base_url, args.model) | |
| score, raw = score_policy( | |
| base_url=args.base_url, | |
| model=model, | |
| instruct=args.instruct, | |
| query=query_for(node, args.document_type), | |
| document=args.document, | |
| threshold=args.threshold, | |
| ) | |
| result = { | |
| "classification_mode": "single_policy_node", | |
| "model": model, | |
| "document_type": args.document_type, | |
| "node": node_result(node, score, document_type=args.document_type), | |
| } | |
| if args.raw: | |
| result["raw_response"] = raw | |
| print(json.dumps(result, indent=2, ensure_ascii=False)) | |
| if __name__ == "__main__": | |
| main() | |