{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaL4","dataSources":[{"sourceId":84795,"databundleVersionId":11281725,"isSourceIdPinned":false,"sourceType":"competition"},{"sourceId":10956683,"sourceType":"datasetVersion","datasetId":6816215},{"sourceId":10982514,"sourceType":"datasetVersion","datasetId":6834137},{"sourceId":10982658,"sourceType":"datasetVersion","datasetId":6819152}],"dockerImageVersionId":30919,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!cp /kaggle/input/llama-server-l4/packages/var/cache/apt/archives/* .","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T14:45:25.583311Z","iopub.execute_input":"2025-03-10T14:45:25.583614Z","iopub.status.idle":"2025-03-10T14:45:35.561792Z","shell.execute_reply.started":"2025-03-10T14:45:25.583588Z","shell.execute_reply":"2025-03-10T14:45:35.560942Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T14:45:38.606361Z","iopub.execute_input":"2025-03-10T14:45:38.606662Z","iopub.status.idle":"2025-03-10T14:45:53.333414Z","shell.execute_reply.started":"2025-03-10T14:45:38.606636Z","shell.execute_reply":"2025-03-10T14:45:53.332644Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!rm /etc/apt/sources.list","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T14:46:02.304177Z","iopub.execute_input":"2025-03-10T14:46:02.304494Z","iopub.status.idle":"2025-03-10T14:46:02.420738Z","shell.execute_reply.started":"2025-03-10T14:46:02.304469Z","shell.execute_reply":"2025-03-10T14:46:02.419878Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!echo \"deb [trusted=yes] file:$(pwd) ./\" | sudo tee /etc/apt/sources.list","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T14:46:03.593673Z","iopub.execute_input":"2025-03-10T14:46:03.594046Z","iopub.status.idle":"2025-03-10T14:46:03.835241Z","shell.execute_reply.started":"2025-03-10T14:46:03.594014Z","shell.execute_reply":"2025-03-10T14:46:03.834441Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!sudo apt-get update -o Dir::Etc::sourcelist=\"sources.list\" -o Dir::Etc::sourceparts=\"-\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T14:46:05.317675Z","iopub.execute_input":"2025-03-10T14:46:05.318017Z","iopub.status.idle":"2025-03-10T14:46:05.800123Z","shell.execute_reply.started":"2025-03-10T14:46:05.317988Z","shell.execute_reply":"2025-03-10T14:46:05.799332Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!sudo apt install cuda-compat-12-2","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T14:46:06.697636Z","iopub.execute_input":"2025-03-10T14:46:06.697991Z","iopub.status.idle":"2025-03-10T14:46:16.339963Z","shell.execute_reply.started":"2025-03-10T14:46:06.697962Z","shell.execute_reply":"2025-03-10T14:46:16.339187Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!sudo apt install nvidia-cuda-dev","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T14:46:16.340935Z","iopub.execute_input":"2025-03-10T14:46:16.34118Z","iopub.status.idle":"2025-03-10T14:46:52.550133Z","shell.execute_reply.started":"2025-03-10T14:46:16.341159Z","shell.execute_reply":"2025-03-10T14:46:52.549366Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!rm *.deb","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T14:47:02.066132Z","iopub.execute_input":"2025-03-10T14:47:02.066453Z","iopub.status.idle":"2025-03-10T14:47:02.387703Z","shell.execute_reply.started":"2025-03-10T14:47:02.066428Z","shell.execute_reply":"2025-03-10T14:47:02.386734Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!cp -r /kaggle/input/llama-ccp/llama.cpp .","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T15:00:12.044992Z","iopub.execute_input":"2025-03-10T15:00:12.045304Z","iopub.status.idle":"2025-03-10T15:00:17.920513Z","shell.execute_reply.started":"2025-03-10T15:00:12.045278Z","shell.execute_reply":"2025-03-10T15:00:17.919675Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!rm -r llama.cpp/build","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T15:12:35.907481Z","iopub.execute_input":"2025-03-10T15:12:35.907796Z","iopub.status.idle":"2025-03-10T15:12:36.022218Z","shell.execute_reply.started":"2025-03-10T15:12:35.907773Z","shell.execute_reply":"2025-03-10T15:12:36.02154Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!cd llama.cpp/examples/server/public && gzip -k index.html loading.html","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T15:12:18.672675Z","iopub.execute_input":"2025-03-10T15:12:18.673007Z","iopub.status.idle":"2025-03-10T15:12:18.916478Z","shell.execute_reply.started":"2025-03-10T15:12:18.672981Z","shell.execute_reply":"2025-03-10T15:12:18.915561Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!CUDA_HOME=/usr/local/cuda-12.2 PATH=$CUDA_HOME/bin:$PATH LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH cmake llama.cpp -B llama.cpp/build -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=\"89-real\" -DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.2/bin/nvcc","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T15:12:37.415181Z","iopub.execute_input":"2025-03-10T15:12:37.415426Z","iopub.status.idle":"2025-03-10T15:12:41.636056Z","shell.execute_reply.started":"2025-03-10T15:12:37.415405Z","shell.execute_reply":"2025-03-10T15:12:41.635289Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!cmake --build llama.cpp/build --config Release -j --clean-first --target llama-server","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T15:12:43.063743Z","iopub.execute_input":"2025-03-10T15:12:43.064053Z","iopub.status.idle":"2025-03-10T15:15:40.539836Z","shell.execute_reply.started":"2025-03-10T15:12:43.064027Z","shell.execute_reply":"2025-03-10T15:15:40.539084Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!cp llama.cpp/build/bin/llama-* /kaggle/working/","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T15:15:46.532975Z","iopub.execute_input":"2025-03-10T15:15:46.533291Z","iopub.status.idle":"2025-03-10T15:15:46.650985Z","shell.execute_reply.started":"2025-03-10T15:15:46.533266Z","shell.execute_reply":"2025-03-10T15:15:46.650168Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# !CUDA_VISIBLE_DEVICES=0 ./llama-server --model /kaggle/input/qwq-unsloth/QwQ-32B-Q4_K_M.gguf --threads 12 --ctx-size 14000 --n-gpu-layers 99 --seed 340 --prio 2 --temp 0.6 --repeat-penalty 1.0 --dry-multiplier 0.5 --min-p 0.1 --top-k 40 --top-p 0.95 --samplers \"top_k;top_p;min_p;temperature;dry;typ_p;xtc\" -fa","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-03-10T15:19:25.218899Z","iopub.execute_input":"2025-03-10T15:19:25.219196Z","iopub.status.idle":"2025-03-10T15:19:25.222374Z","shell.execute_reply.started":"2025-03-10T15:19:25.219172Z","shell.execute_reply":"2025-03-10T15:19:25.221724Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}