Image-Text-to-Text
MLX
Safetensors
English
nemotron_h
nemotron
nemotron-h
mamba
mamba2
ssm
mixture-of-experts
multimodal
vision
audio
video
speech
omni
reasoning
jang
JANG_4M
apple-silicon
conversational
custom_code
Instructions to use OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M 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("OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M") config = load_config("OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M") # 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 OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M"
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": "OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M 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 "OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M"
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 OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M"
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 "OsaurusAI/Nemotron-3-Nano-Omni-30B-A3B-JANG_4M" \ --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"
Nemotron-3-Nano-Omni-30B-A3B JANG_4M — calibrated affine (imatrix+AWQ), full omni towers
2eb8892 verified | from typing import List, Optional, Union, Any, Dict | |
| from PIL import Image | |
| import torch | |
| from transformers.image_processing_base import BatchFeature | |
| from transformers.image_processing_utils_fast import BaseImageProcessorFast, divide_to_patches | |
| from transformers.image_utils import (make_list_of_images, get_image_size, | |
| get_image_type, ImageInput, ImageType, ChannelDimension) | |
| from transformers.utils import TensorType | |
| import torchvision.transforms as T | |
| def get_internvl_target_ratios( | |
| min_num: int, | |
| max_num: int, | |
| ) -> list[tuple[int, int]]: | |
| target_ratios = {(i, j) | |
| for n in range(min_num, max_num + 1) | |
| for i in range(1, n + 1) | |
| for j in range(1, n + 1) if min_num <= i * j <= max_num} | |
| return sorted(target_ratios, key=lambda x: x[0] * x[1]) | |
| def find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height, image_size): | |
| best_factor = float('-inf') | |
| best_ratio = (1, 1) | |
| area = width * height | |
| for ratio in target_ratios: | |
| target_aspect_ratio = ratio[0] / ratio[1] | |
| factor_based_on_area_n_ratio = min( | |
| (ratio[0]*ratio[1]*image_size*image_size)/ area, 0.6 | |
| )* min( | |
| target_aspect_ratio/aspect_ratio, aspect_ratio/target_aspect_ratio) | |
| if factor_based_on_area_n_ratio > best_factor: | |
| best_factor = factor_based_on_area_n_ratio | |
| best_ratio = ratio | |
| return best_ratio | |
| def calculate_targets( | |
| orig_width: int, | |
| orig_height: int, | |
| target_ratios: list[tuple[int, int]], | |
| image_size: int, | |
| ) -> tuple[int, int, int]: | |
| aspect_ratio = orig_width / orig_height | |
| # find the closest aspect ratio to the target | |
| target_aspect_ratio = find_closest_aspect_ratio( | |
| aspect_ratio, | |
| target_ratios, | |
| width=orig_width, | |
| height=orig_height, | |
| image_size=image_size, | |
| ) | |
| # calculate the target width and height | |
| target_width = image_size * target_aspect_ratio[0] | |
| target_height = image_size * target_aspect_ratio[1] | |
| blocks = target_aspect_ratio[0] * target_aspect_ratio[1] | |
| return blocks, target_width, target_height | |
| def dynamic_preprocess(image, image_size=512, max_num_tiles=12, use_thumbnail=True): | |
| orig_height, orig_width = get_image_size(image, channel_dim=ChannelDimension.FIRST) | |
| target_ratios = get_internvl_target_ratios(1, max_num_tiles) | |
| blocks, target_width, target_height = calculate_targets( | |
| orig_width, | |
| orig_height, | |
| target_ratios, | |
| image_size | |
| ) | |
| # resize the image | |
| resized_img = T.Resize((target_width, target_height), interpolation=T.InterpolationMode.BICUBIC)(image) | |
| patches = divide_to_patches(resized_img, image_size) | |
| assert len(patches) == blocks | |
| if use_thumbnail and len(patches) != 1: | |
| thumbnail_img = T.Resize((image_size, image_size), interpolation=T.InterpolationMode.BICUBIC)(image) | |
| patches.append(thumbnail_img) | |
| return patches | |