true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10, CURLOPT_FOLLOWLOCATION => true, ]); curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); curl_close($ch); $time = date('H:i:s'); if ($code == 200 && $size > 1000000) { echo "[$time] CHECK $i: HTTP $code | SIZE " . round($size/1024/1024) . "MB | FOUND!\n"; $found = true; // Download GGUF echo "\n=== DOWNLOADING GGUF ===\n"; @mkdir('/opt/wevia-brain/finetune', 0777, true); $dest = '/opt/wevia-brain/finetune/weval-brain-v3-ft.gguf'; // Use wget for large file $dlCmd = "wget -q '$ggufUrl' -O '$dest' 2>&1"; echo "Downloading... (this may take a few minutes)\n"; $dlOut = shell_exec($dlCmd); if (file_exists($dest) && filesize($dest) > 1000000) { $sizeMB = round(filesize($dest) / 1024 / 1024); echo "Downloaded: {$sizeMB}MB\n"; // Create Ollama model echo "\n=== CREATING OLLAMA MODEL ===\n"; $createCh = curl_init('http://127.0.0.1:11435/api/create'); curl_setopt_array($createCh, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode([ 'name' => 'weval-brain-v3-ft', 'from' => 'weval-brain-v3', 'stream' => false, ]), CURLOPT_HTTPHEADER => ['Content-Type: application/json'], CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60, ]); $createR = curl_exec($createCh); curl_close($createCh); echo "Ollama: $createR\n"; // Update router $router = '/opt/wevia-brain/wevia-master-router.php'; $rc = file_get_contents($router); $rc = str_replace('weval-brain-v3', 'weval-brain-v3-ft', $rc); file_put_contents($router, $rc); echo "Router: updated to weval-brain-v3-ft\n"; echo "\n=== DONE! WEVAL-BRAIN-V3-FT IS LIVE ===\n"; } else { echo "Download failed\n"; } break; } else { // Also check the repo itself $repoCh = curl_init("https://huggingface.co/api/models/yace222/weval-brain-v3-gguf"); curl_setopt_array($repoCh, [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 5]); $repoR = curl_exec($repoCh); $repoCode = curl_getinfo($repoCh, CURLINFO_HTTP_CODE); curl_close($repoCh); $repoExists = ($repoCode == 200) ? "repo exists" : "no repo yet"; echo "[$time] CHECK $i/$maxChecks: HTTP $code | $repoExists | waiting...\n"; } sleep(30); } if (!$found) { echo "\nTimeout: GGUF not found after " . ($maxChecks * 30 / 60) . " min\n"; echo "Training may still be running on Colab\n"; }