|
MODEL_NAME= llongma-3b |
|
PYTHON?= python |
|
LLAMA_TAG= 7487137 |
|
LLAMA_TAR= master-$(LLAMA_TAG).tar.gz |
|
LLAMA_DIR= llama.cpp-master-$(LLAMA_TAG) |
|
LLAMA_FLAGS= LLAMA_NO_K_QUANTS=1 |
|
HF_REPO= conceptofmind/LLongMA-3b |
|
HF_REF= main |
|
HF_FILES= pytorch_model.bin \ |
|
tokenizer.model \ |
|
config.json |
|
$(HF_FILES): SITE= https://huggingface.co/$(HF_REPO)/resolve/$(HF_REF) |
|
$(LLAMA_TAR): SITE= https://github.com/ggerganov/llama.cpp/archive/refs/tags |
|
|
|
FILES= $(HF_FILES) $(LLAMA_TAR) |
|
|
|
QUANTS= f16 q4_0 q4_1 q5_0 q5_1 q8_0 |
|
MODEL_FILES= $(foreach q,$(QUANTS),$(MODEL_NAME)-$(q).bin) |
|
|
|
.PHONY: all |
|
all: $(MODEL_FILES) SHA256SUMS |
|
|
|
$(FILES): |
|
curl -L -o $@ --url $(SITE)/$@ |
|
|
|
$(LLAMA_DIR): | $(LLAMA_TAR) |
|
tar -xf $(LLAMA_TAR) |
|
|
|
$(LLAMA_DIR)/quantize: | $(LLAMA_DIR) |
|
$(MAKE) -C $(LLAMA_DIR) $(LLAMA_FLAGS) quantize |
|
|
|
$(MODEL_NAME)-f16.bin: $(HF_FILES) | $(LLAMA_DIR) |
|
$(PYTHON) $(LLAMA_DIR)/convert.py --outtype f16 --outfile $@ . |
|
|
|
$(MODEL_NAME)-q%.bin: $(MODEL_NAME)-f16.bin $(LLAMA_DIR)/quantize |
|
$(LLAMA_DIR)/quantize $< $@ q$* |
|
|
|
%.sha: % |
|
sha256sum $< > $@ |
|
|
|
SHA256SUMS: $(addsuffix .sha,$(MODEL_FILES)) |
|
cat $^ > $@ |
|
|