-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (50 loc) · 2.23 KB
/
Copy pathMakefile
File metadata and controls
63 lines (50 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
.PHONY: up down rebuild logs shell pull-model clean status health test-chat gpu-test
COMPOSE_FILE := docker-compose.yml
ENV_FILE := .env
up: pull-model
docker compose --env-file $(ENV_FILE) -f $(COMPOSE_FILE) up -d
down:
docker compose --env-file $(ENV_FILE) -f $(COMPOSE_FILE) down
rebuild: down up
logs:
docker compose --env-file $(ENV_FILE) -f $(COMPOSE_FILE) logs -f --tail=100
shell:
docker compose --env-file $(ENV_FILE) -f $(COMPOSE_FILE) exec llama-server sh
pull-model:
@mkdir -p models
@MODEL_FILE=$$(grep MODEL_FILE $(ENV_FILE) | cut -d'=' -f2); \
if [ -f "models/$$MODEL_FILE" ]; then \
echo "Model already exists: models/$$MODEL_FILE"; \
else \
echo "Downloading model: $$MODEL_FILE"; \
if command -v huggingface-cli >/dev/null 2>&1; then \
huggingface-cli download LiquidAI/LFM2.5-1.2B-Instruct-GGUF \
--include "$$MODEL_FILE" \
--local-dir models --local-dir-use-symlinks False; \
elif command -v wget >/dev/null 2>&1; then \
wget -P models "https://huggingface.co/LiquidAI/LFM2.5-1.2B-Instruct-GGUF/resolve/main/$$MODEL_FILE"; \
else \
echo "Error: Neither huggingface-cli nor wget found. Install one to download models."; \
exit 1; \
fi; \
fi
clean:
docker compose --env-file $(ENV_FILE) -f $(COMPOSE_FILE) down -v --remove-orphans
docker image prune -f
rm -rf models/*
status:
docker compose --env-file $(ENV_FILE) -f $(COMPOSE_FILE) ps
health:
@echo "Checking server health..."
@curl -sf http://localhost:$(shell grep HOST_PORT $(ENV_FILE) | cut -d'=' -f2)/health && echo "Server healthy" || echo "Server unhealthy"
test-chat:
@curl -s http://localhost:$(shell grep HOST_PORT $(ENV_FILE) | cut -d'=' -f2)/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "lfm2.5-1.2b-instruct", "messages": [{"role": "user", "content": "Hello!"}], "max_tokens": 50}' | jq .
gpu-test:
@echo "Testing GPU detection in container..."
@docker run --rm --gpus all nvidia/cuda:12.6-base nvidia-smi 2>&1 || echo "nvidia-smi failed - check nvidia-container-toolkit installation"
@echo ""
@echo "Testing llama.cpp GPU detection..."
@docker run --rm --gpus all ghcr.io/ggml-org/llama.cpp:server-cuda /app/llama-server --list-devices 2>&1 || echo "llama-server GPU detection failed"
.DEFAULT_GOAL := up