forked from alexzhang13/rlm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (73 loc) · 2.82 KB
/
Makefile
File metadata and controls
94 lines (73 loc) · 2.82 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
.PHONY: help install install-dev install-modal run-all \
quickstart docker-repl lm-repl modal-repl \
lint format test check \
build-vlm-all build-vlm-basic test-vlm test-vlm-basic
help:
@echo "RLM Examples Makefile"
@echo ""
@echo "Usage:"
@echo " make install - Install base dependencies with uv"
@echo " make install-dev - Install dev dependencies with uv"
@echo " make install-modal - Install modal dependencies with uv"
@echo " make run-all - Run all examples (requires all deps and API keys)"
@echo ""
@echo "Examples:"
@echo " make quickstart - Run quickstart.py (needs OPENAI_API_KEY)"
@echo " make docker-repl - Run docker_repl_example.py (needs Docker)"
@echo " make lm-repl - Run lm_in_repl.py (needs PORTKEY_API_KEY)"
@echo " make modal-repl - Run modal_repl_example.py (needs Modal)"
@echo ""
@echo "Development:"
@echo " make lint - Run ruff linter"
@echo " make format - Run ruff formatter"
@echo " make test - Run tests"
@echo " make check - Run lint + format + tests"
@echo ""
@echo "VLM Tests (require Docker + OPENAI_API_KEY):"
@echo " make test-vlm - Build all VLM images and run all VLM tests"
@echo " make test-vlm-basic - Build and run test_one_image + test_pdf2image only"
install:
uv sync
install-dev:
uv sync --group dev --group test
install-modal:
uv pip install -e ".[modal]"
run-all: quickstart docker-repl lm-repl modal-repl
quickstart: install
uv run python -m examples.quickstart
docker-repl: install
uv run python -m examples.docker_repl_example
lm-repl: install
uv run python -m examples.lm_in_repl
modal-repl: install-modal
uv run python -m examples.modal_repl_example
lint: install-dev
uv run ruff check .
format: install-dev
uv run ruff format .
test: install-dev
uv run pytest
check: lint format test
# VLM Tests (require Docker and OPENAI_API_KEY)
VLM_DOCKERFILE = tests/vlm/Dockerfile
VLM_FIXTURES = test_one_image test_n_images test_pdf2image test_supported_formats
build-vlm-all:
@for fixture in $(VLM_FIXTURES); do \
echo "Building rlm-vlm-$$fixture..."; \
docker build -f $(VLM_DOCKERFILE) --build-arg FIXTURE=$$fixture -t rlm-vlm-$$fixture . ; \
done
build-vlm-basic:
docker build -f $(VLM_DOCKERFILE) --build-arg FIXTURE=test_one_image -t rlm-vlm-test-one-image .
docker build -f $(VLM_DOCKERFILE) --build-arg FIXTURE=test_pdf2image -t rlm-vlm-test-pdf2image .
docker-rm-all:
@for fixture in $(VLM_FIXTURES); do \
echo "Removing rlm-vlm-$$fixture..."; \
docker rmi rlm-vlm-$$fixture; \
done
MAX_ITERATIONS ?= 10
test-vlm: build-vlm-all
uv run pytest tests/vlm/ -v --max-iterations=$(MAX_ITERATIONS)
test-vlm-basic: build-vlm-basic
uv run pytest tests/vlm/ -k "test_one_image or test_pdf2image" -v --max-iterations=$(MAX_ITERATIONS)
clean:
docker-rm-all