chatgpt:= https://chatgpt.com/share/69141b4b-3448-800e-87ef-fb83c51228e9 https://chatgpt.com/share/69141b4b-3448-800e-87ef-fb83c51228e9 Tutorial: How to Edit Run.bat for Llama.cpp Local Server Step 1: Locate the Run.bat File Go to the folder where you downloaded Llama.cpp. Example path: D:\Flie\llama.cpp You will see Run.bat inside this folder. Step 2: Open Run.bat for Editing Right-click Run.bat → Choose Edit or Open with Notepad. This will open the batch file and you can see the code inside. Step 3: Edit the Base Directory Look for the line that defines the BASE_DIR. Example: SET BASE_DIR=D:\Flie\llama.cpp Replace D:\Flie\llama.cpp with your own Llama.cpp folder location if it’s different. Step 4: Check Models Folder Make sure you have a models folder inside your base folder. Place all your .gguf model files inside this folder. The batch file line should look like: SET MODELS_DIR=%BASE_DIR%\models Step 5: Save the File After editing the path, click File → Save in Notepad. Close Notepad. Step 6: Run the File Double-click Run.bat. You will see a list of models with numbers. Type the number of the model you want to run and press Enter. The server will start and automatically open the browser at: http://127.0.0.1:8080/ --- Step 7: Optional GPU/CPU Settings The batch file uses GPU by default: --n-gpu-layers 999 If you want CPU only, edit the line in Run.bat like this: --n-gpu-layers 0 --- ✅ Now your Run.bat is ready and will always show your models and run the server correctly. --- ٹیوٹوریل: Run.bat کو ایڈٹ کرنا اور ماڈل فولڈر لوکیشن دینا (اردو) Step 1: Run.bat فائل تلاش کریں وہ فولڈر کھولیں جہاں آپ نے Llama.cpp رکھا ہوا ہے۔ مثال: D:\Flie\llama.cpp یہاں آپ کو Run.bat نظر آئے گا۔ Step 2: Run.bat کھولیں Run.bat پر Right-click → Edit یا Open with Notepad کریں۔ Notepad میں فائل کھل جائے گی اور آپ کو کوڈ نظر آئے گا۔ Step 3: Base Directory ایڈٹ کریں وہ لائن تلاش کریں جو BASE_DIR define کرتی ہے۔ مثال: SET BASE_DIR=D:\Flie\llama.cpp اگر آپ نے Llama.cpp کسی اور فولڈر میں رکھا ہے تو اس کا path یہاں دیں۔ Step 4: Models فولڈر چیک کریں یقین کریں کہ base folder میں models فولڈر موجود ہے۔ اپنے تمام .gguf ماڈلز اس میں رکھیں۔ Batch فائل میں یہ لائن اس طرح ہونی چاہیے: SET MODELS_DIR=%BASE_DIR%\models Step 5: فائل Save کریں Notepad میں File → Save کریں۔ Notepad بند کر دیں۔ Step 6: Run کریں Run.bat پر Double-click کریں۔ ماڈلز کی لسٹ نمبر کے ساتھ دکھائی دے گی۔ جس ماڈل کو چلانا ہے اس کا نمبر لکھیں اور Enter دبائیں۔ Server start ہو جائے گا اور browser خود بخود کھلے گا: http://127.0.0.1:8080/ --- Step 7: GPU یا CPU موڈ Default GPU استعمال ہوتا ہے: --n-gpu-layers 999 اگر CPU پر چلانا ہو تو 0 لکھیں: --n-gpu-layers 0 --- ✅ اب آپ کا Run.bat بالکل تیار ہے۔ یہ ہمیشہ ماڈل لسٹ دکھائے گا اور server صحیح طریقے سے چلائے گا۔ run.bat @echo off Title 🦙 Llama.cpp Local Server - GPU + Model Selector + Auto Chrome REM --- PATH SETTINGS --- SET BASE_DIR=D:\Flie\llama.cpp SET MODELS_DIR=%BASE_DIR%\models SET SERVER_EXE=%BASE_DIR%\llama-server.exe REM --- SERVER SETTINGS --- SET HOST_IP=0.0.0.0 SET PORT=8080 SET GPU_LAYERS=999 SET CONTEXT_SIZE=4096 echo ============================================ echo 🦙 Llama.cpp Local Server - Model Selector echo ============================================ echo. echo Available Models in: %MODELS_DIR% echo. REM --- LIST ALL MODELS --- SETLOCAL ENABLEDELAYEDEXPANSION SET COUNT=0 for %%f in ("%MODELS_DIR%\*.gguf") do ( SET /A COUNT+=1 echo !COUNT!. %%~nxf SET "MODEL[!COUNT!]=%%~nxf" ) echo. set /p choice=Enter the model number to load: IF "%choice%"=="" ( echo No selection made. Exiting... pause exit /b ) SET SELECTED_MODEL=!MODEL[%choice%]! echo. echo ✅ Selected model: %SELECTED_MODEL% echo --------------------------------------------- SET MODEL_PATH="%MODELS_DIR%\%SELECTED_MODEL%" echo Starting llama-server with %SELECTED_MODEL% on GPU... echo. REM --- START SERVER --- start "" "%SERVER_EXE%" --n-gpu-layers %GPU_LAYERS% --ctx-size %CONTEXT_SIZE% --port %PORT% --host %HOST_IP% -m %MODEL_PATH% REM --- OPEN CHROME AUTOMATICALLY --- timeout /t 2 >nul start "" chrome http://127.0.0.1:%PORT%/ echo. echo 🦙 Server started. Browser should open automatically. pause