Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (74 loc) · 2.63 KB
/
Copy pathMakefile
File metadata and controls
95 lines (74 loc) · 2.63 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.PHONY: build up down shell test run clean logs lint format
# Docker commands
build:
docker-compose build
up:
docker-compose up -d
down:
docker-compose down
shell:
docker-compose exec kotoba bash
logs:
docker-compose logs -f
# Development commands
dev:
docker-compose run --rm kotoba kotoba --config configs/dev.yaml
test:
docker-compose run --rm kotoba pytest tests/ -v
run:
docker-compose run --rm kotoba kotoba $(ARGS)
# Local installation commands
install-local:
pip install -e .
playwright install chromium
run-local:
kotoba $(ARGS)
dev-local:
kotoba --config configs/dev.yaml
# Test with lightweight setup (no LLM)
test-light:
docker-compose -f docker-compose.test.yml build
docker-compose -f docker-compose.test.yml up -d
docker-compose -f docker-compose.test.yml exec kotoba-test kotoba --config configs/dev.yaml -t tests/the_internet_test.yaml --no-headless
docker-compose -f docker-compose.test.yml down
run-light:
docker-compose -f docker-compose.test.yml run --rm kotoba-test kotoba $(ARGS)
# Code quality
lint:
docker-compose run --rm kotoba ruff check src/ tests/
format:
docker-compose run --rm kotoba ruff format src/ tests/
# Clean commands
clean:
docker-compose down -v
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
clean-cache:
docker-compose down -v
docker volume rm kotoba_hf_cache kotoba_pip_cache kotoba_torch_cache || true
# Model management
download-model:
docker-compose run --rm kotoba python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; AutoTokenizer.from_pretrained('$(MODEL)'); AutoModelForCausalLM.from_pretrained('$(MODEL)')"
list-models:
docker-compose run --rm kotoba python -c "import os; print('Cached models:'); [print(f) for f in os.listdir('/home/testuser/.cache/huggingface/hub') if f.startswith('models--')]"
# Installation
install:
@echo "Building Docker image..."
@make build
@echo "Installation complete!"
# Help
help:
@echo "Available commands:"
@echo " make build - Build Docker image"
@echo " make up - Start containers in detached mode"
@echo " make down - Stop containers"
@echo " make shell - Enter container shell"
@echo " make test - Run tests"
@echo " make run - Run kotoba with arguments (ARGS='--help')"
@echo " make dev - Run in development mode"
@echo " make lint - Run linter"
@echo " make format - Format code"
@echo " make clean - Clean up temporary files"
@echo " make clean-cache - Clean up all Docker volumes and caches"
@echo " make download-model MODEL=<model_name> - Pre-download specific model"
@echo " make list-models - List cached models"