File size: 504 Bytes
7de15fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import sys
from pathlib import Path
from config import OUTPUT_DIR
from llama_setup import TextModel, convert_hf_to_gguf

MODEL = Path(OUTPUT_DIR)
OUT = MODEL / f"{MODEL.name}-f16.gguf"

if not (MODEL / "model.safetensors").exists():
    sys.exit("NO MODEL FOUND!")


TextModel.get_vocab_base_pre = lambda self, tokenizer: "gpt-2"
sys.argv = ["convert_hf_to_gguf.py", str(MODEL), "--outfile", str(OUT), "--outtype", "f16"]
convert_hf_to_gguf.main()
print(f"done: {OUT} ({OUT.stat().st_size // 1024} KB)")