Image-Text-to-Text
MLX
Safetensors
inkling2_loop
mlx-vlm
conversational
Mixture of Experts
6bit
6-bit
Instructions to use nativ-community/Inkling-2-Mini-6bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use nativ-community/Inkling-2-Mini-6bit 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("nativ-community/Inkling-2-Mini-6bit") config = load_config("nativ-community/Inkling-2-Mini-6bit") # 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 nativ-community/Inkling-2-Mini-6bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "nativ-community/Inkling-2-Mini-6bit"
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": "nativ-community/Inkling-2-Mini-6bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use nativ-community/Inkling-2-Mini-6bit 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 "nativ-community/Inkling-2-Mini-6bit"
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 nativ-community/Inkling-2-Mini-6bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use nativ-community/Inkling-2-Mini-6bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "nativ-community/Inkling-2-Mini-6bit"
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 "nativ-community/Inkling-2-Mini-6bit" \ --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 convert_from_native.py from nativ-community/Inkling-2-Mini-6bit: direct link, hf CLI and curl.
- Browser
- Download file 2.7 kB
-
https://huggingface.co/nativ-community/Inkling-2-Mini-6bit/resolve/main/convert_from_native.py
- Command line
-
hf download hf://nativ-community/Inkling-2-Mini-6bit/convert_from_native.py
-
curl -L -o convert_from_native.py https://huggingface.co/nativ-community/Inkling-2-Mini-6bit/resolve/main/convert_from_native.py
2.7 kB
| """Reconstruct BF16 weights from the native quantized Inkling 2 Mini release. | |
| Requires the MLX-VLM revision and MLX version documented in the model card. | |
| This is dequantization, not recovery of original pre-quantization weights. | |
| """ | |
| import argparse | |
| import shutil | |
| from pathlib import Path | |
| import mlx.core as mx | |
| from mlx.utils import tree_unflatten | |
| from mlx_vlm.models.switch_layers import SwitchLinear | |
| from mlx_vlm.quantization.nvfp4 import ScaledQuantizedSwitchLinear | |
| from mlx_vlm.utils import fetch_from_hub, get_model_path, save_config, save_weights | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument('--source', default='thinkingmachines/Inkling-2-Mini') | |
| parser.add_argument('--revision', default='c9d028302cd0f035fdf8e7e91f089a4ce94d2195') | |
| parser.add_argument('--output', required=True) | |
| args = parser.parse_args() | |
| source = get_model_path(args.source, revision=args.revision) | |
| output = Path(args.output) | |
| output.mkdir(parents=True, exist_ok=True) | |
| mx.set_cache_limit(0) | |
| model, config, processor = fetch_from_hub(source, lazy=True) | |
| paths = [path for path, module in model.named_modules() if hasattr(module, 'scales')] | |
| assert len(paths) == 72 | |
| for path in paths: | |
| old = dict(model.named_modules())[path] | |
| weight = mx.dequantize( | |
| old.weight, old.scales, old.get('biases'), old.group_size, old.bits, | |
| old.mode, dtype=mx.float32, | |
| ) | |
| if isinstance(old, ScaledQuantizedSwitchLinear): | |
| scale = old.global_scale | |
| weight = old.apply_scale( | |
| weight, scale.reshape(scale.shape + (1,) * (weight.ndim - scale.ndim)) | |
| ) | |
| weight = weight.astype(mx.bfloat16) | |
| mx.eval(weight) | |
| if not bool(mx.all(mx.isfinite(weight)).item()): | |
| raise ValueError(f'Non-finite reconstructed weights in {path}') | |
| new = SwitchLinear(weight.shape[2], weight.shape[1], weight.shape[0], bias='bias' in old) | |
| new.weight = weight | |
| if 'bias' in old: | |
| new.bias = old.bias | |
| model.update_modules(tree_unflatten([(path, new)])) | |
| del old, new, weight | |
| mx.clear_cache() | |
| for key in ('quantization', 'quantization_config'): | |
| config.pop(key, None) | |
| config['dtype'] = 'bfloat16' | |
| save_weights(output, model, donate_weights=True) | |
| save_config(config, output / 'config.json') | |
| for filename in ( | |
| 'chat_template.jinja', 'generation_config.json', 'mtp.safetensors', | |
| 'processor_config.json', 'special_tokens_map.json', 'tokenizer.json', | |
| 'tokenizer_config.json', 'tiktoken/tokenizer.model', | |
| ): | |
| target = output / filename | |
| target.parent.mkdir(parents=True, exist_ok=True) | |
| shutil.copyfile(source / filename, target) | |
| shutil.copyfile(source / 'hf_quant_config.json', output / 'source_hf_quant_config.json') | |
| print(output) | |