Files
comfyui-nvidia/deployments/ai-stack/init-models.sh
T
57_WolveandClaude Opus 4.7 20d4bd5b72 Image Studio: switch base model to qwen3.5:9b (non-abliterated)
The abliterated 9B was the source of the tool-call format mangling
(both Native XML leaks and Default Python-syntax leaks). Standard
qwen3.5:9b is the same family, same 9B size (6.6 GB), vision-capable
and native tool calling actually works.

The image content uncensored-ness was always going to come from the
SDXL checkpoints in ComfyUI — the LLM is just a dispatcher. Picking
a well-behaved tool-caller for that role doesn't compromise output
content.

Updated:
  - image_studio.json base_model_id → qwen3.5:9b
  - init-models.sh: pulls qwen3.5:9b as a standard registry pull,
    in addition to the existing abliterated 9B (which stays for
    other chat models)
  - image_studio.md setup table + vision section explaining why
    we chose standard over abliterated for the dispatcher role

function_calling stays as 'default' and tool_choice as 'required'
for now — they don't hurt with a reliable tool-caller and operators
can flip back to native + drop tool_choice once they verify it
works for them (which also removes the need for a separate Task
Model for title generation).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 17:09:42 -05:00

69 lines
2.6 KiB
Bash

#!/bin/sh
# Preseed Ollama with the models the stack should have available at startup.
# Runs once via the model-init service (see docker-compose.yml). Safe to
# re-run — already-present models are skipped.
#
# Two pull paths:
# - s3_pull — fetches a tarball from $S3_OLLAMA_BASE (your own mirror,
# created by mirror-ollama-model.sh) and extracts into
# Ollama's data dir. Faster + immune to upstream changes.
# Falls back to ollama pull if S3_OLLAMA_BASE is unset.
# - pull — standard `ollama pull` against registry.ollama.ai.
set -e
# Make sure curl is available — ollama/ollama:latest doesn't always include
# it, and s3_pull needs it. tar is in the base image.
if ! command -v curl >/dev/null 2>&1; then
apt-get update -qq && apt-get install -y -qq curl ca-certificates >/dev/null
fi
S3_OLLAMA_BASE="${S3_OLLAMA_BASE:-}"
OLLAMA_DATA="/root/.ollama"
s3_pull() {
name="$1"; archive="$2"
if ollama list 2>/dev/null | awk 'NR>1 {print $1}' | grep -qx "$name"; then
echo "✓ $name already present"
return
fi
if [ -z "$S3_OLLAMA_BASE" ]; then
echo "→ $name: S3_OLLAMA_BASE unset, falling back to ollama pull"
ollama pull "$name"
return
fi
url="${S3_OLLAMA_BASE%/}/$archive"
echo "→ Downloading $name from $url…"
curl -fL -C - --retry 3 -o "/tmp/$archive" "$url"
tar -xzf "/tmp/$archive" -C "$OLLAMA_DATA/models/"
rm -f "/tmp/$archive"
echo "✓ $name installed (mirror)"
}
pull() {
name="$1"
if ollama list 2>/dev/null | awk 'NR>1 {print $1}' | grep -qx "$name"; then
echo "✓ $name already present"
else
echo "→ Pulling $name from registry.ollama.ai…"
ollama pull "$name"
fi
}
# ─── S3-mirrored models ─────────────────────────────────────────────────────
# These live in your own bucket. Create the tarballs once with
# mirror-ollama-model.sh, upload to S3, then list them here.
s3_pull "huihui_ai/qwen3.5-abliterated:9b" "qwen3.5-abliterated-9b.tgz"
# Standard non-abliterated Qwen 3.5 9B — 6.6 GB, vision + native tool
# calling. Used as the Image Studio dispatcher (the abliterated 9B above
# is fine for chat but mangles native tool-call formatting).
pull "qwen3.5:9b"
# ─── Direct registry pulls ──────────────────────────────────────────────────
for model in dolphin3:8b llama3.1:8b ministral-3:8b mistral-nemo:12b qwen3.6:latest; do
pull "$model"
done
echo "Done."