| PYTHON := python3.12 |
| VENV := .venv |
| PIP := $(VENV)/bin/pip |
| PY := $(VENV)/bin/python |
|
|
| DEPS := \ |
| transformers==4.55.4 \ |
| optimum[onnxruntime] \ |
| safetensors \ |
| torch \ |
| pillow \ |
| sentencepiece \ |
| huggingface-hub |
|
|
| .PHONY: help venv install export compare onnx-infer clean |
|
|
| help: |
| @echo "make venv # create local virtual env" |
| @echo "make install # install python dependencies into .venv" |
| @echo "make export # export ONNX trio into ./onnx" |
| @echo "make compare # run compare_inference.py (uses cat.jpg by default)" |
| @echo "make onnx-infer # run onnx_infer.py with defaults" |
| @echo "make clean # remove .venv and onnx outputs" |
|
|
| venv: |
| @test -d $(VENV) || $(PYTHON) -m venv $(VENV) |
|
|
| install: venv |
| $(PIP) install -U pip setuptools wheel |
| $(PIP) install $(DEPS) |
|
|
| export: install |
| $(PY) export_prefix_vlm.py --output-dir onnx --opset 18 |
|
|
| compare: install |
| $(PY) compare_inference.py --onnx-dir onnx --model-dir . |
|
|
| onnx-infer: install |
| $(PY) onnx_infer.py --export-dir onnx --model-dir . --max-new-tokens 5 |
|
|
| clean: |
| rm -rf $(VENV) onnx |
|
|