Instructions to use compilade/quant-tests with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use compilade/quant-tests with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="compilade/quant-tests", filename="TriLM_1.5B_Unpacked-TQ1_0-F16.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use compilade/quant-tests with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf compilade/quant-tests:F16 # Run inference directly in the terminal: llama cli -hf compilade/quant-tests:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf compilade/quant-tests:F16 # Run inference directly in the terminal: llama cli -hf compilade/quant-tests:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf compilade/quant-tests:F16 # Run inference directly in the terminal: ./llama-cli -hf compilade/quant-tests:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf compilade/quant-tests:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf compilade/quant-tests:F16
Use Docker
docker model run hf.co/compilade/quant-tests:F16
- LM Studio
- Jan
- Ollama
How to use compilade/quant-tests with Ollama:
ollama run hf.co/compilade/quant-tests:F16
- Unsloth Studio
How to use compilade/quant-tests with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for compilade/quant-tests to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for compilade/quant-tests to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for compilade/quant-tests to start chatting
- Atomic Chat new
- Docker Model Runner
How to use compilade/quant-tests with Docker Model Runner:
docker model run hf.co/compilade/quant-tests:F16
- Lemonade
How to use compilade/quant-tests with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull compilade/quant-tests:F16
Run and chat with the model
lemonade run user.quant-tests-F16
List all available models
lemonade list
| set -eux | |
| cd "$(dirname "$0")" | |
| MODEL_DIR="bench-TriLMs-models" | |
| LLAMA_CPP_PATH="." | |
| sizes=("1.5" "2.4" "3.9") | |
| types=("TQ1_0" "TQ2_0" "Q4_K_M" "Q8_0" "F16" "BF16") | |
| gputypes=("TQ2_0" "Q4_K_M" "Q8_0" "F16") | |
| function gather_models() { | |
| echo Gather the models | |
| if [ ! -d "$MODEL_DIR" ]; then | |
| mkdir -p -- "$MODEL_DIR" | |
| fi | |
| ( | |
| cd "$MODEL_DIR" | |
| for sz in "${sizes[@]}"; do | |
| filename="TriLM_${sz}B_Unpacked-TQ1_0-F16.gguf" | |
| if [ ! -f "$filename" ]; then | |
| wget "https://huggingface.co/compilade/quant-tests/resolve/main/${filename}" | |
| fi | |
| done | |
| ) | |
| } | |
| function build_llama_cpp() { | |
| echo Build llama.cpp for CPU | |
| ( | |
| cd -- "$LLAMA_CPP_PATH" | |
| if [ -d build ]; then | |
| pwd | |
| rm -rf build | |
| fi | |
| mkdir build | |
| cd build | |
| cmake .. "$@" | |
| make -j llama-bench llama-quantize | |
| ) | |
| } | |
| function quantize() { | |
| echo "Make all model types we'll test" | |
| ( | |
| for sz in "${sizes[@]}"; do | |
| for ty in "${types[@]}"; do | |
| filenames=("$MODEL_DIR"/TriLM_"${sz}"B_Unpacked-{TQ1_0-F16,"$ty"}.gguf) | |
| if [ ! -f "${filenames[1]}" ]; then | |
| "$LLAMA_CPP_PATH"/build/bin/llama-quantize --allow-requantize "${filenames[@]}" "$ty" | |
| fi | |
| done | |
| done | |
| ) | |
| } | |
| function bench() { | |
| echo Test each model one by one for different numbers of threads | |
| for sz in "${sizes[@]}"; do | |
| for ty in "$@"; do | |
| for th in 1 2 4 8; do | |
| { | |
| "$LLAMA_CPP_PATH"/build/bin/llama-bench -v -m "${MODEL_DIR}/TriLM_${sz}B_Unpacked-${ty}.gguf" -t "${th}" -p 512 -n 128 -r 4 -o json | |
| printf "%s\n" "," | |
| } | |
| done | |
| done | |
| done | |
| } | |
| function bench_cpu() { | |
| bench "${types[@]}" >> "$1" | |
| } | |
| function bench_gpu() { | |
| bench "${gputypes[@]}" >> "$1" | |
| } | |
| currentTime="$(date +'%s')" | |
| resultFile="results-${currentTime}.json" | |
| infoFile="results-${currentTime}-info.txt" | |
| lscpu > "$infoFile" | |
| gather_models | |
| build_llama_cpp -DGGML_NATIVE=ON -DGGML_CPU=ON | |
| quantize | |
| echo "---" >> "$infoFile" | |
| ls -go "$MODEL_DIR" >> "$infoFile" | |
| bench_cpu "$resultFile" | |
| if [ -x "$(command -v nvidia-smi)" ]; then | |
| echo GPU detected, benchark with that too. | |
| build_llama_cpp -DGGML_NATIVE=ON -DGGML_CUDA=ON -DGGML_CUDA_F16=ON | |
| bench_gpu "$resultFile" | |
| fi | |