Text-to-Image
MLX
Safetensors
English
nemotron_h
apple-silicon
mac
autoregressive
mamba
Mixture of Experts
nemotron
nemotron-labs-image
q5
custom_code
Instructions to use VisualInference/Nemotron-Labs-Image-30B-A3B-MLX-5bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use VisualInference/Nemotron-Labs-Image-30B-A3B-MLX-5bit with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download VisualInference/Nemotron-Labs-Image-30B-A3B-MLX-5bit --local-dir Nemotron-Labs-Image-30B-A3B-MLX-5bit
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Download code/scripts/divergence.py from VisualInference/Nemotron-Labs-Image-30B-A3B-MLX-5bit: direct link, hf CLI and curl.
- Browser
- Download file 1.63 kB
-
https://huggingface.co/VisualInference/Nemotron-Labs-Image-30B-A3B-MLX-5bit/resolve/main/code/scripts/divergence.py
- Command line
-
hf download hf://VisualInference/Nemotron-Labs-Image-30B-A3B-MLX-5bit/code/scripts/divergence.py
-
curl -L -o divergence.py https://huggingface.co/VisualInference/Nemotron-Labs-Image-30B-A3B-MLX-5bit/resolve/main/code/scripts/divergence.py
1.63 kB
| """Where do two token streams of the same prompt/seed first differ? Prints token index and grid position. | |
| python divergence.py A.tokens.npy B.tokens.npy --w 1024 [--img A.png --img2 B.png --out marked.png] | |
| """ | |
| import argparse | |
| import numpy as np | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("a"); ap.add_argument("b") | |
| ap.add_argument("--w", type=int, required=True) | |
| ap.add_argument("--img"); ap.add_argument("--img2"); ap.add_argument("--out") | |
| args = ap.parse_args() | |
| a, b = np.load(args.a), np.load(args.b) | |
| n = min(len(a), len(b)) | |
| d = next((i for i in range(n) if a[i] != b[i]), None) | |
| VIS_ROW, IMG_START = 131074, 131072 | |
| def pos(t, i): | |
| rows = int(np.sum(t[:i] == VIS_ROW)) | |
| last = max([k for k in range(i) if t[k] == VIS_ROW], default=None) | |
| col = i - last - 1 if last is not None else None | |
| return rows, col | |
| if d is None: | |
| print(f"identical for all {n} tokens (lengths {len(a)}, {len(b)})") | |
| else: | |
| r, c = pos(a, d) | |
| print(f"first difference at token {d} of {n}: grid row {r - 1 if r else 'header'}, column {c}; " | |
| f"{100 * d / n:.1f}% of the stream identical; ids {a[d]} vs {b[d]}") | |
| if args.img and args.img2 and args.out and r: | |
| from PIL import Image, ImageDraw | |
| A = Image.open(args.img).convert("RGB"); B = Image.open(args.img2).convert("RGB") | |
| y = (r - 1) * 16 | |
| out = Image.new("RGB", (A.width * 2 + 8, A.height), "white") | |
| out.paste(A, (0, 0)); out.paste(B, (A.width + 8, 0)) | |
| dr = ImageDraw.Draw(out) | |
| for x0 in (0, A.width + 8): | |
| dr.line([(x0, y), (x0 + A.width, y)], fill=(255, 0, 0), width=2) | |
| out.save(args.out) | |