-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (54 loc) · 2.46 KB
/
Copy pathMakefile
File metadata and controls
68 lines (54 loc) · 2.46 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
# Development entry points. Nothing here is required to use Thinference;
# every target is a thin wrapper around a command documented in README.md.
PYTHON ?= python3
CONFIG ?= thinference.local.json
IMAGE ?= thinference-test
.PHONY: help test install install-editable package doctor ask chat benchmark \
docker-build docker-test ci
# First target, so a bare `make` explains itself instead of doing work.
help:
@echo "Thinference development targets"
@echo ""
@echo " make test run the full unit suite from src/"
@echo " make install install the package with pip"
@echo " make install-editable install the package in editable mode"
@echo " make package build a wheel into dist/"
@echo " make ci what CI runs: tests, then the wheel build"
@echo ""
@echo " make doctor validate the local runtime and model"
@echo " make ask PROMPT='...' run one non-interactive prompt"
@echo " make chat start one interactive conversation"
@echo " make benchmark run the one fixed CPU-only benchmark"
@echo ""
@echo " make docker-build build the test image ($(IMAGE))"
@echo " make docker-test run the unit suite inside that image"
@echo ""
@echo "Variables: PYTHON=$(PYTHON) CONFIG=$(CONFIG) IMAGE=$(IMAGE)"
@echo "doctor, ask, chat, and benchmark need a real local llama.cpp build"
@echo "and a real model, so they run on the host and never in Docker."
test:
PYTHONPATH=src $(PYTHON) -m unittest discover -s tests -v
install:
$(PYTHON) -m pip install .
install-editable:
$(PYTHON) -m pip install -e .
package:
$(PYTHON) -m pip wheel . --no-deps --wheel-dir dist
doctor:
PYTHONPATH=src $(PYTHON) -m thinference doctor --config $(CONFIG)
# PROMPT is passed as one shell-quoted argument, so a single quote inside it
# would break the quoting; use the documented command directly in that case.
ask:
@test -n "$(PROMPT)" || { echo "make ask requires PROMPT, e.g. make ask PROMPT='your question'" >&2; exit 2; }
PYTHONPATH=src $(PYTHON) -m thinference ask --config $(CONFIG) "$(PROMPT)"
# No pipe and no capture: chat needs the real terminal on stdin and stdout.
chat:
PYTHONPATH=src $(PYTHON) -m thinference chat --config $(CONFIG)
benchmark:
PYTHONPATH=src $(PYTHON) -m thinference benchmark --config $(CONFIG)
docker-build:
docker build -t $(IMAGE) .
docker-test:
docker run --rm $(IMAGE)
# Deliberately no model, no inference, and no benchmark: CI has neither.
ci: test package