Bonsai-8B (llama.cpp)のインストール
llama.cppは多種多様なAIモデルを演算処理するエンジンで、Bonsai-8BなどのAIモデルを読み込んで利用します。
llama.cppのインストール
ソースからビルドするか、バイナリをダウンロードします。
バイナリファイルのダウンロード
$ wget https://github.com/ggml-org/llama.cpp/releases/download/b8777/llama-b8777-bin-ubuntu-x64.tar.gz
展開して下記ディレクトリへ移動・実行ファイルなどを確認
$ tar -xzf llama-b8775-bin-ubuntu-x64.tar.gz
$ cd llama-b8775
$ ls
LICENSE libggml-cpu-zen4.so llama-gemma3-cli
libggml-base.so libggml-rpc.so llama-gguf-split
libggml-base.so.0 libggml.so llama-imatrix
libggml-base.so.0.9.11 libggml.so.0 llama-llava-cli
libggml-cpu-alderlake.so libggml.so.0.9.11 llama-minicpmv-cli
libggml-cpu-cannonlake.so libllama.so llama-mtmd-cli
libggml-cpu-cascadelake.so libllama.so.0 llama-mtmd-debug
libggml-cpu-cooperlake.so libllama.so.0.0.8775 llama-perplexity
libggml-cpu-haswell.so libmtmd.so llama-quantize
libggml-cpu-icelake.so libmtmd.so.0 llama-qwen2vl-cli
libggml-cpu-ivybridge.so libmtmd.so.0.0.8775 llama-results
libggml-cpu-piledriver.so llama-batched-bench llama-server
libggml-cpu-sandybridge.so llama-bench llama-template-analysis
libggml-cpu-sapphirerapids.so llama-cli llama-tokenize
libggml-cpu-skylakex.so llama-completion llama-tts
libggml-cpu-sse42.so llama-debug-template-parser rpc-server
libggml-cpu-x64.so llama-fit-params
huggingfaceからモデルBonsai-8B-ggufを指定・ダウンロードして起動:オプション -hf
$ ./llama-cli -hf prism-ml/Bonsai-8B-gguf
$ ./llama-cli -hf prism-ml/Bonsai-8B-gguf
load_backend: loaded RPC backend from /home/ubuntu/llama.cpp/llama-b8775/libggml-rpc.so
load_backend: loaded CPU backend from /home/ubuntu/llama.cpp/llama-b8775/libggml-cpu-haswell.so
Downloading Bonsai-8B.gguf ───────────────────────────────────────── 100%
Loading model...
▄▄ ▄▄
██ ██
██ ██ ▀▀█▄ ███▄███▄ ▀▀█▄ ▄████ ████▄ ████▄
██ ██ ▄█▀██ ██ ██ ██ ▄█▀██ ██ ██ ██ ██ ██
██ ██ ▀█▄██ ██ ██ ██ ▀█▄██ ██ ▀████ ████▀ ████▀
██ ██
▀▀ ▀▀
build : b8775-920b3e78c
model : prism-ml/Bonsai-8B-gguf
modalities : text
available commands:
/exit or Ctrl+C stop or exit
/regen regenerate the last response
/clear clear the chat history
/read <file> add a text file
/glob <pattern> add text files using globbing pattern
> hello
Hello! I'm Bonsai, an AI assistant developed by PrismML. How can I help you today?
バイナリではとても遅い。ビルドから再検討中。
llama.cppのバイナリについて
llama.cppをdockerコンテナとして利用する場合、以下ハードウェア環境別のDcokerイメージが用意されています。
注)現時点では、Intel CPU搭載のHD GPUにチューニングされたOpenVINO対応のllama.cppでBonsai-8Bモデルは動作しません(1ビット量子化モデル未対応)。
# Docker
## Prerequisites
* Docker must be installed and running on your system.
* Create a folder to store big models & intermediate files (ex. /llama/models)
## Images
We have three Docker images available for this project:
1. `ghcr.io/ggml-org/llama.cpp:full`: This image includes both the `llama-cli` and `llama-completion` executables and the tools to convert LLaMA models into ggml and convert into 4-bit quantization. (platforms: `linux/amd64`, `linux/arm64`, `linux/s390x`)
2. `ghcr.io/ggml-org/llama.cpp:light`: This image only includes the `llama-cli` and `llama-completion` executables. (platforms: `linux/amd64`, `linux/arm64`, `linux/s390x`)
3. `ghcr.io/ggml-org/llama.cpp:server`: This image only includes the `llama-server` executable. (platforms: `linux/amd64`, `linux/arm64`, `linux/s390x`)
Additionally, there the following images, similar to the above:
- `ghcr.io/ggml-org/llama.cpp:full-cuda`: Same as `full` but compiled with CUDA 12 support. (platforms: `linux/amd64`, `linux/arm64`)
- `ghcr.io/ggml-org/llama.cpp:full-cuda13`: Same as `full` but compiled with CUDA 13 support. (platforms: `linux/amd64`, `linux/arm64`)
- `ghcr.io/ggml-org/llama.cpp:light-cuda`: Same as `light` but compiled with CUDA 12 support. (platforms: `linux/amd64`, `linux/arm64`)
- `ghcr.io/ggml-org/llama.cpp:light-cuda13`: Same as `light` but compiled with CUDA 13 support. (platforms: `linux/amd64`, `linux/arm64`)
- `ghcr.io/ggml-org/llama.cpp:server-cuda`: Same as `server` but compiled with CUDA 12 support. (platforms: `linux/amd64`, `linux/arm64`)
このファイルは切り詰められています。 オリジナルを表示
ホストPCがインテルCPUでビデオカードを搭載していない場合、注1)OpenVINO または 注2)SYCL を含む条件でビルドしたバイナリを使用することで、AIのパフォーマンスが大幅に改善するものと思われます。
llama.cpp+ OpenVINO
注1)OpenVINO は、インテル製ハードウェア(CPU、GPU、NPU)向けに特化して設計された、高性能なAI推論の最適化とデプロイを行うためのオープンソースツールキットです。
GitHub - openvinotoolkit/openvino: OpenVINO™ is an open source toolkit for optimizing and deploying AI inference · GitHub
# OpenVINO Backend for llama.cpp
> [!NOTE]
> Performance and memory optimizations, accuracy validation, broader quantization coverage, broader operator and model support are work in progress.
[OpenVINO](https://docs.openvino.ai/) is an open-source toolkit for optimizing and deploying high-performance AI inference, specifically designed for Intel hardware, including CPUs, GPUs, and NPUs, in the cloud, on-premises, and on the edge. [OpenVINO backend for llama.cpp](../../ggml/src/ggml-openvino) enables hardware-accelerated inference on **Intel® CPUs, GPUs, and NPUs** while remaining compatible with the existing **GGUF model ecosystem**. The backend translates GGML compute graphs into OpenVINO graphs and leverages graph compilation, kernel fusion, and device-specific optimizations to improve inference performance on supported Intel hardware.
The OpenVINO backend is implemented in `ggml/src/ggml-openvino` and provides a translation layer for core GGML operations. The OpenVINO backend replaces the standard GGML graph execution path with Intel's OpenVINO inference engine. This approach allows the same GGUF model file to run on Intel CPUs, Intel GPUs (integrated and discrete), and Intel NPUs without changes to the model or the rest of the llama.cpp stack. When a `ggml_cgraph` is dispatched to OpenVINO backend, it:
- Walks the GGML graph and identifies inputs, outputs, weights, and KV cache tensors.
- Translates the GGML operations into an `ov::Model` using OpenVINO's frontend API.
- Compiles and caches the model for the target device.
- Binds GGML tensor memory to OpenVINO inference tensors and runs inference.
## Supported Devices
OpenVINO backend supports the following hardware:
- Intel CPUs
- Intel GPUs (integrated and discrete)
このファイルは切り詰められています。 オリジナルを表示
llama.cpp + SYCL
注2)SYCL は、CPU・GPU・FPGAなどのさまざまなハードウェアアクセラレータ向けにコードを書く際の開発者の生産性を向上させるために設計された、高水準の並列プログラミングモデルです。異種コンピューティングのための単一ソース言語であり、標準C++17をベースとしています。
SYCL - C++ Single-source Heterogeneous Programming for Acceleration Offload
# llama.cpp for SYCL
- [Background](#background)
- [Recommended Release](#recommended-release)
- [News](#news)
- [OS](#os)
- [Hardware](#hardware)
- [Docker](#docker)
- [Linux](#linux)
- [Windows](#windows)
- [Environment Variable](#environment-variable)
- [Design Rule](#design-rule)
- [Known Issue](#known-issues)
- [Q&A](#qa)
- [TODO](#todo)
## Background
**SYCL** is a high-level parallel programming model designed to improve developers productivity writing code across various hardware accelerators such as CPUs, GPUs, and FPGAs. It is a single-source language designed for heterogeneous computing and based on standard C++17.
このファイルは切り詰められています。 オリジナルを表示
Bonsai-8Bデモ
Bonsai Demo
所感:8-10世代Intel CPU、ストレージNvme対応SDD、メモリ16GBのホストPCで動作するが、回答の精度では、まだまだ発展途上という印象。
下記で提供されているllama.cppのUbuntu向けにプレビルドされたCPU版バイナリとVulkan版バイナリで評価。