Skip to content

Instantly share code, notes, and snippets.

View ugovaretto's full-sized avatar

Ugo Varetto ugovaretto

View GitHub Profile
@ugovaretto
ugovaretto / qwen3.8-flash-next-mi250.sh
Created November 16, 2026 13:07
Run Qwen3.8-Flash-Next with vllm on Setonix
#!/usr/bin/env bash
# Qwen/Qwen3.8-Flash-Next on 4x MI250X (8 GCDs, gfx90a) with vllm/vllm-openai-rocm:v0.33.0-rocm72.
# The model is a bf16 MoE (Qwen4ExpForConditionalGeneration, ~360 GB on disk): measured 30.8 GiB weights
# per GCD at TP=8. Default (images on, GPU_UTIL 0.90): 884K-token KV cache, startup ~18-21 min.
# Text-only (TEXT_ONLY=1 GPU_UTIL=0.95): 1.12M-token KV cache.
# Container: vllm/vllm-openai-rocm:v0.33.0-rocm72 (ROCm 7.2 build, matches the host ROCm 7.2.4 driver).
# Download it with singularity (~11.5 GB .sif; the pull needs ~70 GB temp space, so keep it off /tmp):
# module load singularity/4.3.5-nompi
# export SINGULARITY_TMPDIR=$MYSCRATCH/singularity/tmp SINGULARITY_CACHEDIR=$MYSCRATCH/singularity/cache
# mkdir -p $SINGULARITY_TMPDIR $SINGULARITY_CACHEDIR
@ugovaretto
ugovaretto / MONITORING.md
Last active October 10, 2026 09:00
Strix Halo RDMA over Thunderbolt — two-host TP=2 setup for Qwen3.8-Flash-Next

Monitoring the Two-Host TP2 Server

Where the logs live and how to see concurrency and speculative-decoding health for the gufo Qwen3.8-Flash-Next TP2 pair (see TP2-SETUP.md).

Log files

What Where
rank 0 — all requests and events strix-halo-1:~/tp2-swap.log (llama-swap wrapper tees gufo output here)
@ugovaretto
ugovaretto / BUILD-LOCAL.md
Created October 10, 2026 04:11
Build gufo inference engine on CachyOS Strix Halo

Local TP2 build on the twin Strix Halo hosts (CachyOS)

How the gufo executables on strix-halo-1 and strix-halo-2 were built, and why the naive build fails on these machines.

The README is written for two toolchains: Nix (not installed here) or "With Nix-less" with the qualified toolchain GCC 15.3 + ROCm 7.2.3. These CachyOS boxes have GCC 16.2.1 and the rocm-gfx1151-bin package layout and no Nix, so three extra problems had to be worked around. Those are almost certainly why a naive build attempt fails.

@ugovaretto
ugovaretto / nerdfonts.js
Last active October 10, 2026 04:09
Show nerdfonts in Deepseek Harness web terminal using Tampermonkey script
// Tampermonkey scriot: USE EXISTING HEADER, REMOVE THIS HEADER AND ONLY COPY THE CODE AFTER 'user strict'
// ==UserScript==
// @name DeepSeek Local Nerd Font Canvas Enforcer
// @match *://*:3080/*
// @run-at document-start
// @grant none
// ==UserScript==
(function() {
'use strict';
@ugovaretto
ugovaretto / APPEND_SYSTEM.md
Last active July 25, 2026 15:11
Pi coding agent append to system prompt

MANDATORY RULES

  • Do not use XML tags like <tool_call> or <function> or any XML tag at all.
  • You must respond strictly using standard OpenAI JSON tool calling syntax.
  • If you need to call a tool, output a JSON object matching this schema: {"name": "tool_name", "arguments": {"arg1": "value", "arg2":"value",...,"argN":"value"}}.
  • Stick to the plan, do not go off and do things which are not related to the current task.
  • Follow user instructions e.g. if the user asks you to load a skill just load, undersrand and memorize the skill DO NOT USE IT until it's required.
  • You can only access resources in the current directory; you are not allowed to access resources outside the current directory.
  • Always think before making any chage to the code.
  • Create a mental sandbox to simulate the impact of the chages you make before making them.
@ugovaretto
ugovaretto / remote-proxy.sh
Created July 22, 2026 08:40
Reverse proxy from compute node to remote client
ssh -J <username>@<remote-cluster-login-address> -R 7777:localhost:7777 <username>@<compute-node name e.g. nid20080> -N
# uv venv
# uv pip install gguf
# uv run gguf-jinja-dump.py <gguf ..0001 file>
from gguf import GGUFReader
import sys
def get_jinja_template(file_path):
reader = GGUFReader(file_path)
# The key is standard for tokenizer chat templates
@ugovaretto
ugovaretto / concurrent.py
Created January 29, 2026 07:54
concurrent python async vs sync vs multithreading
import asyncio
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
import sys
async def do_async_work(task_id: int, duration: float = 0.1) -> str:
await asyncio.sleep(duration)
return f"Task {task_id} completed"
async def run_asyncio(tasks: int=5):
@ugovaretto
ugovaretto / crush.json
Created December 18, 2025 09:22
Crush AI configuration
{
"$schema": "https://charm.land/crush.json",
"mcp": {
"websearch-fetch-mcp": {
"type": "stdio",
"command": "uv",
"args": [
"run",
"--with", "fastmcp",
"--with", "requests",
@ugovaretto
ugovaretto / bash-ai.py
Created December 15, 2025 16:16
Use AI to generate system commands
#!/usr/bin/env python3
import os
import sys
import requests
import json
import argparse
def generate_bash_command(prompt):
api_key = os.getenv('BASH_AI_KEY')
api_url = os.getenv('BASH_URL_KEY', "http://localhost:11434/v1/chat/completions")