CoolFace
Modelpublic

mozilla-ai/TriLM-llamafile

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
18likes875downloads
Model Card

TriLM - llamafile

This is a 1.58 bit ternary LLM whose weights consist of {-1, 0, +1}. It's highly optimized for CPU performance, thanks to the `Q2_K_S` quantization format.

This repository packages and distributes TriLM as executable weights, which we call llamafiles. The files you download here will run on Linux, MacOS, Windows, FreeBSD, OpenBSD, and NetBSD for AMD64 and ARM64.

Quickstart

Running the following on a desktop OS will launch a tab in your web browser with a completions interface.

wget https://huggingface.co/Mozilla/TriLM-llamafile/resolve/main/TriLM_3.9B.llamafile
chmod +x TriLM_3.9B.llamafile
./TriLM_3.9B.llamafile

You can also use the command line interface:

./TriLM_3.9B.llamafile -p "this is my prompt"

For further information, please see the llamafile README.

Having trouble? See the "Gotchas" section of the README.

Prompting

This is a base model. It hasn't been fine-tuned for chat. It's recommended that the completions interface be used.

It's recommended with the smaller TriLM models (e.g. 99M) that a high repeat penalty be set, e.g. --repeat-penalty 10. When using the CLI mode, this flag is specified by default in the .args file embedded within the llamafiles from this repo.

Benchmarks

cpu\_infomodel\_filenamesizetestt/s
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_3.9B.llamafile1.31 GiBpp5121069.54
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_3.9B.llamafile1.31 GiBtg1688.47
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_2.4B.llamafile837.02 MiBpp5121441.04
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_2.4B.llamafile837.02 MiBtg16110.80
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_1.5B.llamafile531.44 MiBpp5122185.94
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_1.5B.llamafile531.44 MiBtg16154.59
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_1.1B.llamafile408.66 MiBpp5122692.87
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_1.1B.llamafile408.66 MiBtg16173.08
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_830M.llamafile301.76 MiBpp5123353.51
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_830M.llamafile301.76 MiBtg16191.98
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_560M.llamafile211.21 MiBpp5124297.08
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_560M.llamafile211.21 MiBtg16209.57
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_390M.llamafile148.93 MiBpp5125130.90
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_390M.llamafile148.93 MiBtg16221.88
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_99M.llamafile148.93 MiBpp5125127.00
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_99M.llamafile148.93 MiBtg16218.93
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_190M.llamafile78.55 MiBpp51210874.11
AMD Ryzen Threadripper PRO 7995WX (znver4)TriLM\_190M.llamafile78.55 MiBtg16334.45
Apple M2 Ultra (+fp16+dotprod)TriLM\_3.9B.llamafile1.31 GiBpp512227.95
Apple M2 Ultra (+fp16+dotprod)TriLM\_3.9B.llamafile1.31 GiBtg1665.17
Apple M2 Ultra (+fp16+dotprod)TriLM\_2.4B.llamafile837.02 MiBpp512347.93
Apple M2 Ultra (+fp16+dotprod)TriLM\_2.4B.llamafile837.02 MiBtg1648.26
Apple M2 Ultra (+fp16+dotprod)TriLM\_1.5B.llamafile531.44 MiBpp512588.86
Apple M2 Ultra (+fp16+dotprod)TriLM\_1.5B.llamafile531.44 MiBtg16140.22
Apple M2 Ultra (+fp16+dotprod)TriLM\_1.1B.llamafile408.66 MiBpp512767.47
Apple M2 Ultra (+fp16+dotprod)TriLM\_1.1B.llamafile408.66 MiBtg16167.80
Apple M2 Ultra (+fp16+dotprod)TriLM\_830M.llamafile301.76 MiBpp5121031.20
Apple M2 Ultra (+fp16+dotprod)TriLM\_830M.llamafile301.76 MiBtg16204.46
Apple M2 Ultra (+fp16+dotprod)TriLM\_560M.llamafile211.21 MiBpp5121487.29
Apple M2 Ultra (+fp16+dotprod)TriLM\_560M.llamafile211.21 MiBtg16245.53
Apple M2 Ultra (+fp16+dotprod)TriLM\_390M.llamafile148.93 MiBpp5122049.02
Apple M2 Ultra (+fp16+dotprod)TriLM\_390M.llamafile148.93 MiBtg16332.24
Apple M2 Ultra (+fp16+dotprod)TriLM\_99M.llamafile148.93 MiBpp5122103.34
Apple M2 Ultra (+fp16+dotprod)TriLM\_99M.llamafile148.93 MiBtg16301.31
Apple M2 Ultra (+fp16+dotprod)TriLM\_190M.llamafile78.55 MiBpp5124762.49
Apple M2 Ultra (+fp16+dotprod)TriLM\_190M.llamafile78.55 MiBtg16553.83
Intel Core i9-14900K (alderlake)TriLM\_3.9B.llamafile1.31 GiBpp512167.15
Intel Core i9-14900K (alderlake)TriLM\_3.9B.llamafile1.31 GiBtg1653.22
Intel Core i9-14900K (alderlake)TriLM\_2.4B.llamafile837.02 MiBpp512261.73
Intel Core i9-14900K (alderlake)TriLM\_2.4B.llamafile837.02 MiBtg1678.39
Intel Core i9-14900K (alderlake)TriLM\_1.5B.llamafile531.44 MiBpp512426.17
Intel Core i9-14900K (alderlake)TriLM\_1.5B.llamafile531.44 MiBtg16123.91
Intel Core i9-14900K (alderlake)TriLM\_1.1B.llamafile408.66 MiBpp512563.58
Intel Core i9-14900K (alderlake)TriLM\_1.1B.llamafile408.66 MiBtg16159.13
Intel Core i9-14900K (alderlake)TriLM\_830M.llamafile301.76 MiBpp512763.27
Intel Core i9-14900K (alderlake)TriLM\_830M.llamafile301.76 MiBtg16209.42
Intel Core i9-14900K (alderlake)TriLM\_560M.llamafile211.21 MiBpp5121116.30
Intel Core i9-14900K (alderlake)TriLM\_560M.llamafile211.21 MiBtg16295.71
Intel Core i9-14900K (alderlake)TriLM\_390M.llamafile148.93 MiBpp5121586.69
Intel Core i9-14900K (alderlake)TriLM\_390M.llamafile148.93 MiBtg16377.50
Intel Core i9-14900K (alderlake)TriLM\_99M.llamafile148.93 MiBpp5121587.38
Intel Core i9-14900K (alderlake)TriLM\_99M.llamafile148.93 MiBtg16401.37
Intel Core i9-14900K (alderlake)TriLM\_190M.llamafile78.55 MiBpp5123713.16
Intel Core i9-14900K (alderlake)TriLM\_190M.llamafile78.55 MiBtg16845.54
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_3.9B.llamafile1.31 GiBpp51217.02
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_3.9B.llamafile1.31 GiBtg166.67
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_2.4B.llamafile837.02 MiBpp51226.35
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_2.4B.llamafile837.02 MiBtg1610.52
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_1.5B.llamafile531.44 MiBpp51242.52
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_1.5B.llamafile531.44 MiBtg1616.91
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_1.1B.llamafile408.66 MiBpp51256.57
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_1.1B.llamafile408.66 MiBtg1620.54
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_390M.llamafile148.93 MiBpp512146.67
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_390M.llamafile148.93 MiBtg1656.77
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_99M.llamafile148.93 MiBpp512147.65
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_99M.llamafile148.93 MiBtg1658.24
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_190M.llamafile78.55 MiBpp512338.42
Raspberry Pi 5 Model B Rev 1.0 (+fp16+dotprod)TriLM\_190M.llamafile78.55 MiBtg16107.33

About llamafile

llamafile is a new format introduced by Mozilla Ocho on Nov 20th 2023. It uses Cosmopolitan Libc to turn LLM weights into runnable llama.cpp binaries that run on the stock installs of six OSes for both ARM64 and AMD64.


TriLM 3.9B Unpacked

TriLM (ternary model), unpacked to FP16 format - compatible with FP16 GEMMs. After unpacking, TriLM has the same architecture as LLaMa.

python
import transformers as tf, torch
model_name = "SpectraSuite/TriLM_3.9B_Unpacked"

# Please adjust the temperature, repetition penalty, top_k, top_p and other sampling parameters according to your needs.
pipeline = tf.pipeline("text-generation", model=model_id, model_kwargs={"torch_dtype": torch.float16}, device_map="auto")

# These are base (pretrained) LLMs that are not instruction and chat tuned. You may need to adjust your prompt accordingly.
pipeline("Once upon a time")
  • License: Apache 2.0
  • We will use our GitHub repo for communication (including HF repo related queries). Feel free to open an issue here https://github.com/NolanoOrg/SpectraSuite