From a6aa9a0efac0795439fadb57b905bd568a3330bd Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Wed, 11 Mar 2026 18:10:25 +0000 Subject: [PATCH 1/3] Remove test_llama_cpp.ps1 from tracking --- test_llama_cpp.ps1 | 234 --------------------------------------------- 1 file changed, 234 deletions(-) delete mode 100644 test_llama_cpp.ps1 diff --git a/test_llama_cpp.ps1 b/test_llama_cpp.ps1 deleted file mode 100644 index b98177eac6..0000000000 --- a/test_llama_cpp.ps1 +++ /dev/null @@ -1,234 +0,0 @@ -<# -.SYNOPSIS - Test script for llama.cpp compilation and binary validation on Windows. - Verifies that llama-server was built with CUDA support and can start. - -.USAGE - .\test_llama_cpp.ps1 - .\test_llama_cpp.ps1 -BinaryPath "C:\path\to\llama-server.exe" -#> -param( - [string]$BinaryPath = "" -) - -$ErrorActionPreference = "Continue" - -Write-Host "" -Write-Host "============================================" -ForegroundColor Cyan -Write-Host " llama.cpp Windows Build Test" -ForegroundColor Cyan -Write-Host "============================================" -ForegroundColor Cyan -Write-Host "" - -# -- Step 1: Locate the binary ------------------------------------------ -Write-Host "1. Locating llama-server binary..." -ForegroundColor Yellow - -$SearchPaths = @() - -if ($BinaryPath) { - $SearchPaths += $BinaryPath -} - -# Add all known locations -$RepoRoot = $PSScriptRoot -$SearchPaths += Join-Path $RepoRoot "llama.cpp\build\bin\Release\llama-server.exe" -$SearchPaths += Join-Path $RepoRoot "llama.cpp\build\bin\llama-server.exe" -# Legacy: older setup.ps1 built under ~/.unsloth -$SearchPaths += Join-Path $env:USERPROFILE ".unsloth\llama.cpp\build\bin\Release\llama-server.exe" - -# Check LLAMA_SERVER_PATH env var -$envPath = $env:LLAMA_SERVER_PATH -if ($envPath) { - $SearchPaths = @($envPath) + $SearchPaths -} - -# Also check system PATH -$systemPath = (Get-Command llama-server -ErrorAction SilentlyContinue) -if ($systemPath) { - $SearchPaths += $systemPath.Source -} - -$FoundBinary = $null -foreach ($p in $SearchPaths) { - if (Test-Path $p) { - $FoundBinary = $p - break - } -} - -if (-not $FoundBinary) { - Write-Host " [FAIL] llama-server.exe not found!" -ForegroundColor Red - Write-Host "" - Write-Host " Searched locations:" -ForegroundColor Gray - foreach ($p in $SearchPaths) { - Write-Host " - $p" -ForegroundColor Gray - } - Write-Host "" - Write-Host " To fix: Run setup.bat to build llama.cpp, or set:" -ForegroundColor Yellow - Write-Host ' $env:LLAMA_SERVER_PATH = "C:\path\to\llama-server.exe"' -ForegroundColor Yellow - exit 1 -} - -Write-Host " [OK] Found: $FoundBinary" -ForegroundColor Green - -# -- Step 2: Check file info -------------------------------------------- -Write-Host "" -Write-Host "2. Binary info..." -ForegroundColor Yellow - -$fileInfo = Get-Item $FoundBinary -$sizeMB = [math]::Round($fileInfo.Length / 1MB, 1) -Write-Host " Size: $sizeMB MB" -ForegroundColor Gray -Write-Host " Modified: $($fileInfo.LastWriteTime)" -ForegroundColor Gray - -# -- Step 3: Check for CUDA symbols ------------------------------------ -Write-Host "" -Write-Host "3. Checking for CUDA support..." -ForegroundColor Yellow - -# Run with --help or -v and capture output to check for CUDA indicators -$helpOutput = & $FoundBinary --version 2>&1 | Out-String -if (-not $helpOutput) { - $helpOutput = "" -} - -# Check binary dependencies for CUDA DLLs using dumpbin if available -$dumpbin = (Get-Command dumpbin -ErrorAction SilentlyContinue) -$hasCudaDlls = $false - -if ($dumpbin) { - $deps = & dumpbin /dependents $FoundBinary 2>&1 | Out-String - if ($deps -match "cudart|cublas|cublasLt|nvcuda") { - $hasCudaDlls = $true - Write-Host " [OK] CUDA DLLs found in dependencies (dumpbin)" -ForegroundColor Green - # Extract CUDA DLL names - $cudaDlls = ($deps -split "`n") | Where-Object { $_ -match "cuda|cublas|nvcuda" } | ForEach-Object { $_.Trim() } - foreach ($dll in $cudaDlls) { - if ($dll) { Write-Host " - $dll" -ForegroundColor Gray } - } - } else { - Write-Host " [WARN] No CUDA DLLs found in dependencies!" -ForegroundColor Red - Write-Host " This binary was likely compiled WITHOUT -DGGML_CUDA=ON" -ForegroundColor Red - } -} else { - # Fallback: check file size (CUDA builds are typically > 50MB) - if ($sizeMB -gt 40) { - Write-Host " [LIKELY OK] Binary is $sizeMB MB (CUDA builds are typically > 50MB)" -ForegroundColor Green - } else { - Write-Host " [WARN] Binary is only $sizeMB MB (CPU-only builds are typically < 30MB)" -ForegroundColor Yellow - Write-Host " dumpbin not available for detailed check. Install VS Build Tools." -ForegroundColor Gray - } -} - -# -- Step 4: Quick startup test ----------------------------------------- -Write-Host "" -Write-Host "4. Running startup test (will start and immediately stop)..." -ForegroundColor Yellow - -# Start llama-server on a random port with no model -- just check it initializes -$testPort = Get-Random -Minimum 49152 -Maximum 65535 -$proc = $null - -try { - $proc = Start-Process -FilePath $FoundBinary ` - -ArgumentList "--port", $testPort, "--host", "127.0.0.1" ` - -PassThru -NoNewWindow -RedirectStandardError "$env:TEMP\llama_test_stderr.txt" ` - -RedirectStandardOutput "$env:TEMP\llama_test_stdout.txt" - - # Give it 3 seconds to start - Start-Sleep -Seconds 3 - - # Check if it crashed - if ($proc.HasExited) { - $exitCode = $proc.ExitCode - $stderr = "" - if (Test-Path "$env:TEMP\llama_test_stderr.txt") { - $stderr = Get-Content "$env:TEMP\llama_test_stderr.txt" -Raw - } - $stdout = "" - if (Test-Path "$env:TEMP\llama_test_stdout.txt") { - $stdout = Get-Content "$env:TEMP\llama_test_stdout.txt" -Raw - } - - $allOutput = "$stdout`n$stderr" - - if ($allOutput -match "failed to initialize CUDA") { - Write-Host " [FAIL] CUDA initialization failed!" -ForegroundColor Red - Write-Host " The binary was compiled without CUDA support or CUDA drivers are missing." -ForegroundColor Red - Write-Host "" - Write-Host " Rebuild with: cmake -DGGML_CUDA=ON ..." -ForegroundColor Yellow - } elseif ($allOutput -match "HTTPS is not supported") { - # This is expected when LLAMA_CURL=OFF -- not a real failure - Write-Host " [OK] Binary started (HTTPS warning is expected -- we use local files)" -ForegroundColor Green - } else { - Write-Host " [WARN] Process exited with code $exitCode" -ForegroundColor Yellow - } - - if ($allOutput.Trim()) { - Write-Host "" - Write-Host " --- Output ---" -ForegroundColor Gray - $allOutput.Trim().Split("`n") | ForEach-Object { Write-Host " $_" -ForegroundColor Gray } - } - } else { - Write-Host " [OK] llama-server started successfully on port $testPort" -ForegroundColor Green - - # Check CUDA detection from startup output - Start-Sleep -Seconds 1 - $stderr = "" - if (Test-Path "$env:TEMP\llama_test_stderr.txt") { - $stderr = Get-Content "$env:TEMP\llama_test_stderr.txt" -Raw - } - - if ($stderr -match "CUDA") { - if ($stderr -match "failed to initialize CUDA") { - Write-Host " [FAIL] CUDA init failed at runtime!" -ForegroundColor Red - } else { - Write-Host " [OK] CUDA detected at runtime" -ForegroundColor Green - } - } - - # Kill it - Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue - Write-Host " Stopped test server." -ForegroundColor Gray - } -} catch { - Write-Host " [ERROR] Could not start llama-server: $_" -ForegroundColor Red -} finally { - if ($proc -and -not $proc.HasExited) { - Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue - } - Remove-Item "$env:TEMP\llama_test_stderr.txt" -ErrorAction SilentlyContinue - Remove-Item "$env:TEMP\llama_test_stdout.txt" -ErrorAction SilentlyContinue -} - -# -- Step 5: Check llama-quantize --------------------------------------- -Write-Host "" -Write-Host "5. Checking llama-quantize..." -ForegroundColor Yellow - -$quantizePath = Join-Path (Split-Path $FoundBinary) "llama-quantize.exe" -if (Test-Path $quantizePath) { - $qSize = [math]::Round((Get-Item $quantizePath).Length / 1MB, 1) - Write-Host " [OK] Found: $quantizePath ($qSize MB)" -ForegroundColor Green -} else { - Write-Host " [WARN] llama-quantize.exe not found alongside llama-server" -ForegroundColor Yellow - Write-Host " GGUF export/quantization won't work without it" -ForegroundColor Yellow -} - -# -- Summary ------------------------------------------------------------ -Write-Host "" -Write-Host "============================================" -ForegroundColor Cyan -Write-Host " Summary" -ForegroundColor Cyan -Write-Host "============================================" -ForegroundColor Cyan -Write-Host " Binary: $FoundBinary" -ForegroundColor Gray -Write-Host " Size: $sizeMB MB" -ForegroundColor Gray -if ($hasCudaDlls) { - Write-Host " CUDA: YES (confirmed via DLL deps)" -ForegroundColor Green -} elseif ($sizeMB -gt 40) { - Write-Host " CUDA: LIKELY (large binary size)" -ForegroundColor Yellow -} else { - Write-Host " CUDA: NO (rebuild with -DGGML_CUDA=ON)" -ForegroundColor Red -} -Write-Host "" - -if (-not $hasCudaDlls -and $sizeMB -le 40) { - Write-Host "To rebuild with CUDA:" -ForegroundColor Yellow - Write-Host ' 1. Delete the build dir: Remove-Item -Recurse -Force "$env:USERPROFILE\.unsloth\llama.cpp\build"' -ForegroundColor Gray - Write-Host ' 2. Re-run: .\setup.bat' -ForegroundColor Gray - Write-Host "" -} From e455b307be123ce6573abb58c994fd84f47ace72 Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Wed, 11 Mar 2026 18:50:11 +0000 Subject: [PATCH 2/3] add fmpeg system support for linux and windows --- setup.ps1 | 26 ++++++++++++++++++- .../backend/utils/datasets/model_mappings.py | 8 ++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/setup.ps1 b/setup.ps1 index 5a573126aa..1c05ac064b 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -526,7 +526,31 @@ if ($NeedNode) { Write-Host "[OK] Node $(node -v) | npm $(npm -v)" -ForegroundColor Green # ============================================ -# 1g. Python (>= 3.11 and < 3.14, matching setup.sh) +# 1g. FFmpeg (required for audio model support) +# ============================================ +$HasFFmpeg = $null -ne (Get-Command ffmpeg -ErrorAction SilentlyContinue) +if (-not $HasFFmpeg) { + Write-Host "FFmpeg not found -- installing via winget..." -ForegroundColor Yellow + $HasWinget = $null -ne (Get-Command winget -ErrorAction SilentlyContinue) + if ($HasWinget) { + try { + winget install -e --id Gyan.FFmpeg --source winget --accept-package-agreements --accept-source-agreements 2>&1 | Out-Null + Refresh-Environment + $HasFFmpeg = $null -ne (Get-Command ffmpeg -ErrorAction SilentlyContinue) + } catch { } + } + if (-not $HasFFmpeg) { + Write-Host "[WARN] FFmpeg could not be installed automatically." -ForegroundColor Yellow + Write-Host " Install FFmpeg from https://ffmpeg.org/download.html and re-run." -ForegroundColor Yellow + } else { + Write-Host "[OK] FFmpeg installed: $(ffmpeg -version | Select-Object -First 1)" -ForegroundColor Green + } +} else { + Write-Host "[OK] FFmpeg found: $(ffmpeg -version | Select-Object -First 1)" -ForegroundColor Green +} + +# ============================================ +# 1h. Python (>= 3.11 and < 3.14, matching setup.sh) # ============================================ $HasPython = $null -ne (Get-Command python -ErrorAction SilentlyContinue) $PythonOk = $false diff --git a/studio/backend/utils/datasets/model_mappings.py b/studio/backend/utils/datasets/model_mappings.py index 56e8ea70c1..b91c189c2b 100644 --- a/studio/backend/utils/datasets/model_mappings.py +++ b/studio/backend/utils/datasets/model_mappings.py @@ -419,9 +419,13 @@ TEMPLATE_TO_RESPONSES_MAPPER = { "instruction": "user\n", "response": "model\n", }, - "qwen3-instruct": { + "qwen3.5": { "instruction": "<|im_start|>user\n", - "response": "<|im_start|>assistant\n", + "response": "<|im_start|>assistant\n\n", + }, + "qwen3-instruct": { + "instruction": "1user\n", + "response": "1assistant\n", }, "qwen3-thinking": { "instruction": "<|im_start|>user\n", From a63196c93e2b5c500e1385adbb919695c6b2c2c1 Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Wed, 11 Mar 2026 19:00:29 +0000 Subject: [PATCH 3/3] updated on completion response markers for qwen3.5 --- setup.sh | 23 +++++++++++++++++++ .../backend/utils/datasets/model_mappings.py | 11 +++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 31a518d9c6..2670b51364 100755 --- a/setup.sh +++ b/setup.sh @@ -96,6 +96,29 @@ fi echo "✅ Node $(node -v) | npm $(npm -v)" +# ── 4b. Check / install FFmpeg (required for audio model support) ── +if command -v ffmpeg &>/dev/null; then + echo "✅ FFmpeg found: $(ffmpeg -version 2>&1 | head -1)" +else + echo "⚠️ FFmpeg not found — installing..." + if command -v apt-get &>/dev/null; then + sudo apt-get update -y > /dev/null 2>&1 + sudo apt-get install -y ffmpeg > /dev/null 2>&1 + elif command -v yum &>/dev/null; then + sudo yum install -y ffmpeg > /dev/null 2>&1 + elif command -v brew &>/dev/null; then + brew install ffmpeg > /dev/null 2>&1 + fi + if command -v ffmpeg &>/dev/null; then + echo "✅ FFmpeg installed: $(ffmpeg -version 2>&1 | head -1)" + else + echo "⚠️ Could not install FFmpeg automatically." + echo " Audio model support requires FFmpeg. Install it manually:" + echo " Ubuntu/Debian: sudo apt-get install ffmpeg" + echo " macOS: brew install ffmpeg" + fi +fi + # ── 5. Build frontend ── echo "" echo "Building frontend..." diff --git a/studio/backend/utils/datasets/model_mappings.py b/studio/backend/utils/datasets/model_mappings.py index b91c189c2b..fda8303a30 100644 --- a/studio/backend/utils/datasets/model_mappings.py +++ b/studio/backend/utils/datasets/model_mappings.py @@ -351,6 +351,13 @@ TEMPLATE_TO_MODEL_MAPPER = { "unsloth/Qwen3-30B-A3B-Thinking-2507", "Qwen/Qwen3-30B-A3B-Thinking-2507", ), + "qwen3.5": ( + "unsloth/Qwen3.5-0.8B", + "unsloth/Qwen3.5-2B", + "unsloth/Qwen3.5-4B", + "unsloth/Qwen3.5-27B", + "unsloth/Qwen3.5-35B-A3B", + ), "zephyr": ( "unsloth/zephyr-sft-bnb-4bit", "unsloth/zephyr-sft", @@ -424,8 +431,8 @@ TEMPLATE_TO_RESPONSES_MAPPER = { "response": "<|im_start|>assistant\n\n", }, "qwen3-instruct": { - "instruction": "1user\n", - "response": "1assistant\n", + "instruction": "<|im_start|>user\n", + "response": "<|im_start|>assistant\n", }, "qwen3-thinking": { "instruction": "<|im_start|>user\n",