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
File size: 2,148 Bytes
c001780 | 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | """Contact sheets: rows = cases, columns = variants (optionally blinded), plus 100% crops.
python contact_sheet.py --dirs A=dirA B=dirB ... --out sheet.jpg [--blind key.json] [--crop 256]
Images are matched by file name across dirs.
"""
import argparse, json, random
from pathlib import Path
from PIL import Image, ImageDraw, ImageFont
ap = argparse.ArgumentParser()
ap.add_argument("--dirs", nargs="+", required=True)
ap.add_argument("--out", required=True)
ap.add_argument("--blind", default=None, help="write the column key here and label columns A, B, C...")
ap.add_argument("--thumb", type=int, default=512)
ap.add_argument("--crop", type=int, default=0, help="add a 100%% center crop of this size under each thumb")
ap.add_argument("--names", nargs="*", default=None)
args = ap.parse_args()
dirs = [d.split("=", 1) for d in args.dirs]
names = args.names or sorted({p.name for _, d in dirs for p in Path(d).glob("*.png")})
names = [n for n in names if all((Path(d) / n).exists() for _, d in dirs)]
cols = list(range(len(dirs)))
key = {}
rng = random.Random(0)
font = ImageFont.load_default()
T, C = args.thumb, args.crop
cell_h = T + (C if C else 0) + 24
sheet = Image.new("RGB", (len(dirs) * (T + 8) + 8, len(names) * (cell_h + 8) + 8), "white")
dr = ImageDraw.Draw(sheet)
for r, n in enumerate(names):
order = cols[:]
if args.blind:
rng.shuffle(order)
key[n] = {chr(65 + i): dirs[o][0] for i, o in enumerate(order)}
for ci, o in enumerate(order):
label, d = dirs[o]
im = Image.open(Path(d) / n).convert("RGB")
x0, y0 = 8 + ci * (T + 8), 8 + r * (cell_h + 8)
th = im.copy(); th.thumbnail((T, T))
sheet.paste(th, (x0, y0))
if C:
w, h = im.size
cr = im.crop((w // 2 - C // 2, h // 2 - C // 2, w // 2 + C // 2, h // 2 + C // 2))
sheet.paste(cr, (x0, y0 + T))
dr.text((x0, y0 + T + (C if C else 0) + 4), f"{chr(65 + ci) if args.blind else label} {n}", fill="black", font=font)
sheet.save(args.out, quality=92)
if args.blind:
Path(args.blind).write_text(json.dumps(key, indent=1))
print(args.out, len(names), "rows")
|