updates UI
This commit is contained in:
@@ -20,7 +20,7 @@ echo "Installing services: user=$SVC_USER group=$SVC_GROUP"
|
||||
echo " a6k=$A6K"
|
||||
echo " tour=$TOUR"
|
||||
|
||||
for unit in comfyui-backend comfyui-api comfyui-watcher; do
|
||||
for unit in comfyui-backend comfyui-api; do
|
||||
sed -e "s|__USER__|$SVC_USER|g" \
|
||||
-e "s|__GROUP__|$SVC_GROUP|g" \
|
||||
-e "s|__A6K__|$A6K|g" \
|
||||
@@ -36,10 +36,10 @@ echo "Reloading systemd daemon..."
|
||||
systemctl daemon-reload
|
||||
|
||||
echo "Enabling services + target..."
|
||||
systemctl enable comfyui-backend.service comfyui-api.service comfyui-watcher.service comfyui.target
|
||||
systemctl enable comfyui-backend.service comfyui-api.service comfyui.target
|
||||
|
||||
echo "Starting system..."
|
||||
systemctl start comfyui.target
|
||||
|
||||
echo "Deployment complete."
|
||||
echo "Check status with: systemctl status comfyui.target comfyui-backend comfyui-api comfyui-watcher"
|
||||
echo "Check status with: systemctl status comfyui.target comfyui-backend comfyui-api"
|
||||
|
||||
52
a6000-comfy/install_facefusion.sh
Normal file
52
a6000-comfy/install_facefusion.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# Install FaceFusion 3.x for high-quality face+hair swap.
|
||||
# Clones into ~/facefusion and creates a dedicated venv at ~/facefusion-venv.
|
||||
# Usage: bash tour-comfy/install_facefusion.sh
|
||||
set -e
|
||||
|
||||
FF_DIR="${FACEFUSION_DIR:-$HOME/facefusion}"
|
||||
FF_VENV="${FACEFUSION_VENV:-$HOME/facefusion-venv}"
|
||||
FF_REPO="https://github.com/facefusion/facefusion"
|
||||
|
||||
echo "[facefusion] Installing to $FF_DIR (venv: $FF_VENV)"
|
||||
|
||||
# 1. Clone or update
|
||||
if [ -d "$FF_DIR/.git" ]; then
|
||||
echo "[facefusion] Updating existing clone ..."
|
||||
git -C "$FF_DIR" pull --ff-only
|
||||
else
|
||||
echo "[facefusion] Cloning $FF_REPO ..."
|
||||
git clone "$FF_REPO" "$FF_DIR"
|
||||
fi
|
||||
|
||||
# 2. Create dedicated venv (avoids dependency conflicts with ComfyUI)
|
||||
if [ ! -d "$FF_VENV" ]; then
|
||||
echo "[facefusion] Creating venv at $FF_VENV ..."
|
||||
python3 -m venv "$FF_VENV"
|
||||
fi
|
||||
|
||||
PIP="$FF_VENV/bin/pip"
|
||||
PY="$FF_VENV/bin/python"
|
||||
|
||||
"$PIP" install --upgrade pip wheel
|
||||
|
||||
# 3. Install FaceFusion requirements
|
||||
cd "$FF_DIR"
|
||||
"$PIP" install -r requirements.txt \
|
||||
--extra-index-url https://download.pytorch.org/whl/cu124
|
||||
|
||||
# 4. Download base models (ghost_3_1_256 + gfpgan_1.4 for enhance)
|
||||
echo "[facefusion] Downloading default models via FaceFusion model manager ..."
|
||||
"$PY" facefusion.py \
|
||||
--processors face_swapper hair_swapper face_enhancer \
|
||||
--face-swapper-model ghost_3_1_256 \
|
||||
--face-enhancer-model gfpgan_1.4 \
|
||||
--execution-providers cpu \
|
||||
download-models 2>/dev/null || true
|
||||
|
||||
echo ""
|
||||
echo "[facefusion] Installation complete."
|
||||
echo " Binary: $PY $FF_DIR/facefusion.py"
|
||||
echo " Config: set facefusion_dir/facefusion_venv in tour-comfy/config.json"
|
||||
echo ""
|
||||
echo "Restart the API (start_api.sh) and the 'Hair swap' toggle will activate."
|
||||
83
a6000-comfy/install_gfpgan.sh
Normal file
83
a6000-comfy/install_gfpgan.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
# Install GFPGAN face enhancement into the ComfyUI venv.
|
||||
# Applies two patches for Python 3.13 + newer torchvision compatibility.
|
||||
# Usage: bash tour-comfy/install_gfpgan.sh
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source "$SCRIPT_DIR/env.sh"
|
||||
source "$VENV/bin/activate"
|
||||
|
||||
PYTHON="$VENV/bin/python"
|
||||
PIP="$VENV/bin/pip"
|
||||
|
||||
echo "[gfpgan] Step 1 — install basicsr (with Python 3.13 patch) ..."
|
||||
TMPDIR=$(mktemp -d)
|
||||
curl -sL "https://pypi.io/packages/source/b/basicsr/basicsr-1.4.2.tar.gz" -o "$TMPDIR/basicsr-1.4.2.tar.gz"
|
||||
tar -xzf "$TMPDIR/basicsr-1.4.2.tar.gz" -C "$TMPDIR"
|
||||
|
||||
# Patch 1: fix get_version() — exec() doesn't update locals() in Python 3
|
||||
"$PYTHON" - <<'PYPATCH'
|
||||
import sys, re
|
||||
setup = sys.argv[1]
|
||||
with open(setup) as f:
|
||||
content = f.read()
|
||||
old = "def get_version():\n with open(version_file, 'r') as f:\n exec(compile(f.read(), version_file, 'exec'))\n return locals()['__version__']"
|
||||
new = "def get_version():\n if not os.path.exists(version_file):\n write_version_py()\n globs = {}\n with open(version_file, 'r') as f:\n exec(compile(f.read(), version_file, 'exec'), globs)\n return globs['__version__']"
|
||||
if old in content:
|
||||
content = content.replace(old, new)
|
||||
with open(setup, 'w') as f:
|
||||
f.write(content)
|
||||
print(' Patched setup.py get_version()')
|
||||
else:
|
||||
print(' setup.py pattern not found, skipping patch')
|
||||
PYPATCH
|
||||
"$TMPDIR/basicsr-1.4.2/setup.py" -- "$TMPDIR/basicsr-1.4.2/setup.py" 2>/dev/null || true
|
||||
"$PYTHON" - "$TMPDIR/basicsr-1.4.2/setup.py" <<'PYPATCH'
|
||||
import sys, re, os
|
||||
setup = sys.argv[1]
|
||||
with open(setup) as f:
|
||||
content = f.read()
|
||||
old = "def get_version():\n with open(version_file, 'r') as f:\n exec(compile(f.read(), version_file, 'exec'))\n return locals()['__version__']"
|
||||
new = "def get_version():\n if not os.path.exists(version_file):\n write_version_py()\n globs = {}\n with open(version_file, 'r') as f:\n exec(compile(f.read(), version_file, 'exec'), globs)\n return globs['__version__']"
|
||||
if old in content:
|
||||
content = content.replace(old, new)
|
||||
with open(setup, 'w') as f:
|
||||
f.write(content)
|
||||
print(' Patched setup.py get_version()')
|
||||
else:
|
||||
print(' setup.py already patched or pattern changed, skipping')
|
||||
PYPATCH
|
||||
|
||||
"$PIP" install "$TMPDIR/basicsr-1.4.2/" --no-build-isolation --no-deps -q
|
||||
rm -rf "$TMPDIR"
|
||||
|
||||
echo "[gfpgan] Step 2 — install facexlib and gfpgan ..."
|
||||
"$PIP" install facexlib gfpgan -q
|
||||
|
||||
# Patch 2: fix torchvision functional_tensor import (removed in newer torchvision)
|
||||
DEGR_PY="$VENV/lib/python3.13/site-packages/basicsr/data/degradations.py"
|
||||
if [ -f "$DEGR_PY" ]; then
|
||||
if grep -q "functional_tensor" "$DEGR_PY"; then
|
||||
sed -i 's/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms.functional import rgb_to_grayscale/' "$DEGR_PY"
|
||||
echo "[gfpgan] Patched degradations.py functional_tensor import"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Pre-download the model
|
||||
MODEL_DIR="$HOME/.gfpgan/weights"
|
||||
MODEL_PATH="$MODEL_DIR/GFPGANv1.4.pth"
|
||||
mkdir -p "$MODEL_DIR"
|
||||
if [ ! -f "$MODEL_PATH" ]; then
|
||||
echo "[gfpgan] Downloading GFPGANv1.4.pth (~333 MB) ..."
|
||||
wget -q --show-progress \
|
||||
"https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth" \
|
||||
-O "$MODEL_PATH.tmp"
|
||||
mv "$MODEL_PATH.tmp" "$MODEL_PATH"
|
||||
echo "[gfpgan] Model saved to $MODEL_PATH"
|
||||
else
|
||||
echo "[gfpgan] Model already present: $MODEL_PATH"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "[gfpgan] Done. Restart the API (start_api.sh) to enable face enhancement."
|
||||
@@ -1,198 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PRIMARY_BASE="${PRIMARY_BASE:-qwen3-coder:30b}"
|
||||
PRIMARY_NAME="${PRIMARY_NAME:-junie-qwen3-coder-30b-a6000}"
|
||||
|
||||
ALT_BASE="${ALT_BASE:-qwen2.5-coder:32b}"
|
||||
ALT_NAME="${ALT_NAME:-junie-qwen25-coder-32b-a6000}"
|
||||
|
||||
FAST_BASE="${FAST_BASE:-qwen2.5-coder:7b}"
|
||||
FAST_NAME="${FAST_NAME:-junie-qwen25-coder-7b-fast}"
|
||||
|
||||
PRIMARY_CTX="${PRIMARY_CTX:-65536}"
|
||||
ALT_CTX="${ALT_CTX:-32768}"
|
||||
FAST_CTX="${FAST_CTX:-16384}"
|
||||
|
||||
WORKDIR="${WORKDIR:-$HOME/ollama-junie-a6000}"
|
||||
JUNIE_HOME="${JUNIE_HOME:-$HOME/.junie}"
|
||||
JUNIE_PROFILE="${JUNIE_PROFILE:-local-ollama-a6000}"
|
||||
|
||||
mkdir -p "$WORKDIR" "$JUNIE_HOME/models"
|
||||
|
||||
echo "==> Checking Ollama"
|
||||
if ! command -v ollama >/dev/null 2>&1; then
|
||||
echo "==> Installing Ollama"
|
||||
curl -fsSL https://ollama.com/install.sh | sh
|
||||
fi
|
||||
|
||||
echo "==> Configuring Ollama systemd for A6000 long-context use"
|
||||
if systemctl list-unit-files | grep -q '^ollama\.service'; then
|
||||
sudo mkdir -p /etc/systemd/system/ollama.service.d
|
||||
sudo tee /etc/systemd/system/ollama.service.d/a6000.conf >/dev/null <<EOF
|
||||
[Service]
|
||||
Environment="OLLAMA_HOST=127.0.0.1:11434"
|
||||
Environment="OLLAMA_FLASH_ATTENTION=1"
|
||||
Environment="OLLAMA_KV_CACHE_TYPE=q8_0"
|
||||
Environment="OLLAMA_KEEP_ALIVE=24h"
|
||||
Environment="OLLAMA_NUM_PARALLEL=1"
|
||||
Environment="OLLAMA_MAX_LOADED_MODELS=1"
|
||||
EOF
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable ollama >/dev/null
|
||||
sudo systemctl restart ollama
|
||||
else
|
||||
echo "WARN: ollama.service niet gevonden. Start Ollama handmatig met:"
|
||||
echo 'OLLAMA_HOST=127.0.0.1:11434 OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 OLLAMA_KEEP_ALIVE=24h ollama serve'
|
||||
fi
|
||||
|
||||
echo "==> Pulling base models"
|
||||
ollama pull "$PRIMARY_BASE"
|
||||
ollama pull "$ALT_BASE"
|
||||
ollama pull "$FAST_BASE"
|
||||
|
||||
cat > "$WORKDIR/Modelfile.${PRIMARY_NAME}" <<EOF
|
||||
FROM ${PRIMARY_BASE}
|
||||
|
||||
PARAMETER num_ctx ${PRIMARY_CTX}
|
||||
PARAMETER num_predict 4096
|
||||
PARAMETER temperature 0.3
|
||||
PARAMETER top_p 0.9
|
||||
PARAMETER repeat_penalty 1.05
|
||||
|
||||
SYSTEM """
|
||||
You are a senior software-engineering coding agent inside a JetBrains/Junie workflow.
|
||||
|
||||
Rules:
|
||||
- Be precise, deterministic, and practical.
|
||||
- Prefer small, safe, reviewable changes.
|
||||
- Read surrounding code before proposing edits.
|
||||
- Preserve existing architecture and style.
|
||||
- For code changes, explain intent briefly and produce clean patches.
|
||||
- Do not invent files, APIs, commands, or project structure.
|
||||
- When uncertain, inspect first instead of guessing.
|
||||
- Keep output concise unless a deeper design answer is needed.
|
||||
"""
|
||||
EOF
|
||||
|
||||
cat > "$WORKDIR/Modelfile.${ALT_NAME}" <<EOF
|
||||
FROM ${ALT_BASE}
|
||||
|
||||
PARAMETER num_ctx ${ALT_CTX}
|
||||
PARAMETER num_predict 4096
|
||||
PARAMETER temperature 0.25
|
||||
PARAMETER top_p 0.9
|
||||
PARAMETER repeat_penalty 1.05
|
||||
|
||||
SYSTEM """
|
||||
You are a senior coding assistant optimized for Java, Kotlin, Python, TypeScript, SQL, Linux, Docker, and architecture work.
|
||||
|
||||
Rules:
|
||||
- Give direct, technically correct answers.
|
||||
- Prefer minimal diffs and commands that can be copied.
|
||||
- Do not hallucinate APIs or project files.
|
||||
- Ask only when blocked; otherwise make a reasonable local change plan.
|
||||
"""
|
||||
EOF
|
||||
|
||||
cat > "$WORKDIR/Modelfile.${FAST_NAME}" <<EOF
|
||||
FROM ${FAST_BASE}
|
||||
|
||||
PARAMETER num_ctx ${FAST_CTX}
|
||||
PARAMETER num_predict 2048
|
||||
PARAMETER temperature 0.2
|
||||
PARAMETER top_p 0.9
|
||||
|
||||
SYSTEM """
|
||||
You are a fast helper model for summarizing, routing, and classifying coding context.
|
||||
Be concise and preserve exact technical details.
|
||||
"""
|
||||
EOF
|
||||
|
||||
echo "==> Creating tuned Ollama models"
|
||||
ollama create "$PRIMARY_NAME" -f "$WORKDIR/Modelfile.${PRIMARY_NAME}"
|
||||
ollama create "$ALT_NAME" -f "$WORKDIR/Modelfile.${ALT_NAME}"
|
||||
ollama create "$FAST_NAME" -f "$WORKDIR/Modelfile.${FAST_NAME}"
|
||||
|
||||
echo "==> Creating Junie CLI custom model profile"
|
||||
cat > "$JUNIE_HOME/models/${JUNIE_PROFILE}.json" <<EOF
|
||||
{
|
||||
"id": "${PRIMARY_NAME}",
|
||||
"baseUrl": "http://localhost:11434/v1/chat/completions",
|
||||
"apiType": "OpenAICompletion",
|
||||
"temperature": 0.3,
|
||||
"extraHeaders": {
|
||||
"X-Custom-Source": "Junie-Ollama-A6000"
|
||||
},
|
||||
"primaryModel": {
|
||||
"id": "${PRIMARY_NAME}",
|
||||
"temperature": 0.3
|
||||
},
|
||||
"fasterModel": {
|
||||
"id": "${FAST_NAME}",
|
||||
"temperature": 0.2
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "==> Setting Junie CLI default model profile"
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
CONFIG="$JUNIE_HOME/config.json" python3 - <<'PY'
|
||||
import json, os, pathlib, shutil
|
||||
|
||||
path = pathlib.Path(os.environ["CONFIG"])
|
||||
profile = "local-ollama-a6000"
|
||||
|
||||
if path.exists():
|
||||
backup = path.with_suffix(".json.bak")
|
||||
shutil.copy2(path, backup)
|
||||
try:
|
||||
data = json.loads(path.read_text())
|
||||
except Exception:
|
||||
data = {}
|
||||
else:
|
||||
data = {}
|
||||
|
||||
data["model"] = profile
|
||||
data["model-default-locations"] = True
|
||||
|
||||
path.write_text(json.dumps(data, indent=2) + "\n")
|
||||
PY
|
||||
else
|
||||
echo "WARN: python3 ontbreekt; zet handmatig in ~/.junie/config.json:"
|
||||
echo '{ "model": "local-ollama-a6000", "model-default-locations": true }'
|
||||
fi
|
||||
|
||||
echo "==> Preloading primary model"
|
||||
curl -s http://127.0.0.1:11434/api/generate \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"model\":\"${PRIMARY_NAME}\",\"prompt\":\"\",\"keep_alive\":-1}" >/dev/null || true
|
||||
|
||||
echo "==> Testing OpenAI-compatible endpoint"
|
||||
curl -s http://127.0.0.1:11434/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"model\": \"${PRIMARY_NAME}\",
|
||||
\"messages\": [{\"role\":\"user\",\"content\":\"Return exactly: OK\"}],
|
||||
\"stream\": false
|
||||
}" | sed 's/,/,\n/g' | head -40
|
||||
|
||||
echo
|
||||
echo "Done."
|
||||
echo
|
||||
echo "Models:"
|
||||
ollama list | grep -E "${PRIMARY_NAME}|${ALT_NAME}|${FAST_NAME}" || true
|
||||
echo
|
||||
echo "Check GPU load with:"
|
||||
echo " ollama ps"
|
||||
echo " watch -n 1 nvidia-smi"
|
||||
echo
|
||||
echo "Junie CLI:"
|
||||
echo " cd /path/to/project"
|
||||
echo " junie --model ${JUNIE_PROFILE}"
|
||||
echo
|
||||
echo "IntelliJ AI Assistant:"
|
||||
echo " Settings > Tools > AI Assistant > Providers & API keys > Ollama"
|
||||
echo " Host: http://localhost:11434"
|
||||
echo " Model: ${PRIMARY_NAME}"
|
||||
@@ -15,8 +15,15 @@ NV_LIBS=$(find "$VENV"/lib/python*/site-packages/nvidia -maxdepth 2 -name lib -t
|
||||
export COMFY_URL="http://127.0.0.1:8188"
|
||||
export HOST="0.0.0.0"
|
||||
export PORT="8500"
|
||||
|
||||
# A6000 48GB is not VRAM-bound here, so default to a ~2MP output budget.
|
||||
# This comfortably allows full-HD-ish outputs like 1920x1080.
|
||||
# Override via MAX_AREA when needed.
|
||||
export MAX_AREA="${MAX_AREA:-2097152}"
|
||||
|
||||
# @LEGACY PREVIOUS VERSION
|
||||
# The A6000 is fast and not VRAM-bound on this model, so default to a full ~1MP
|
||||
# output budget (tour caps at 0.65MP to survive the MI50). Override via MAX_AREA.
|
||||
export MAX_AREA="${MAX_AREA:-1048576}"
|
||||
# export MAX_AREA="${MAX_AREA:-1048576}"
|
||||
|
||||
exec python edit_api.py
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
[Unit]
|
||||
Description=Qwen-Image-Edit Folder Watcher (A6000)
|
||||
After=comfyui-api.service
|
||||
Requires=comfyui-api.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__USER__
|
||||
Group=__GROUP__
|
||||
ExecStart=/bin/bash __TOUR__/start_watcher.sh
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=comfyui.target
|
||||
@@ -1,7 +1,7 @@
|
||||
[Unit]
|
||||
Description=Qwen-Image-Edit Complete System (A6000)
|
||||
Wants=comfyui-backend.service comfyui-api.service comfyui-watcher.service
|
||||
After=comfyui-watcher.service
|
||||
Description=Afterimage (A6000)
|
||||
Wants=comfyui-backend.service comfyui-api.service
|
||||
After=comfyui-backend.service comfyui-api.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Reference in New Issue
Block a user