


Selamat datang di Libllm, proyek open-source yang dirancang untuk inferensi yang efisien dari model bahasa besar (LLM) di komputer pribadi dan perangkat seluler biasa. Inti diimplementasikan dalam C ++ 14, tanpa dependensi pihak ketiga (seperti BLAS atau kalimat), memungkinkan operasi tanpa batas di berbagai perangkat.
Selamat datang di Libllm, proyek open source yang dirancang untuk inferensi yang efisien dari model bahasa besar (LLM) pada rata -rata komputer pribadi dan perangkat seluler. Inti ditulis dalam C ++ 14, dan tidak memiliki dependensi pihak ketiga (BLA, kalimat, dll.), Dan dapat berjalan dengan mulus di berbagai perangkat.
| Model | Unduh | perintah llm |
|---|---|---|
| Indeks-1.9b-karakter (bermain peran) | [? Hf] [ms] | LLM CHAT -M INDEX: KARAKTER |
| Index-1.9b-chat | [? Hf] [ms] | LLM obrolan -m indeks |
| QWEN2-1.5B-INSTRUCT | [? Hf] [ms] | obrolan llm -m qwen: 1.5b |
| QWEN2-7B-INSTRUCT | [? Hf] [ms] | obrolan llm -m qwen: 7b |
| Llama3.2-1b-instruct | [? Hf] [ms] | LLM CHAT -M LLAMA3.2: 1B |
| Llama3.2-3b-instruct | [? Hf] [ms] | LLM CHAT -M LLAMA3.2 |
| Whisper-Large-V3 | [? Hf] [ms] | llm transcribe -m Whisper |
HF = huggingface, MS = modelcope
| Os | Platform | Cuda | avx2 | AVX512 | Asimdhp |
|---|---|---|---|---|---|
| Linux | x64 | ✅ | ✅ | ✅ | |
| Windows | x64 | ✅ | ✅ | ✅ | |
| MacOS | ARM64 | ✅ |
llm chat -model index-character akan secara otomatis mengunduh model index-character dari? Huggingface. Untuk menjalankan dan mengobrol dengan bilibili-index-1.9b-karakter:
$ llm chat -m index-character Ini akan secara otomatis mengunduh Bilibili-Index-1.9B-Character dari Huggingface atau Modelscope (di Cina), dan memulai CHAT CLI di LLM.
Obrolan dengan model Bilibili-Index-1.9B-Character :
$ llm chat -m index-character llm akan secara otomatis mengunduh model Bilibili-Index-1.9B-Character dari huggingface atau modelcope (jika itu IP Cina) dan mulailah berbicara dengannya.
$ src/libllm/llm chat -m index-character
INFO 2024-07-30T12:02:28Z interface.cc:67] ISA support: AVX2=1 F16C=1 AVX512F=1
INFO 2024-07-30T12:02:28Z interface.cc:71] Use Avx512 backend.
INFO 2024-07-30T12:02:30Z matmul.cc:43] Use GEMM from cuBLAS.
INFO 2024-07-30T12:02:30Z cuda_operators.cc:51] cuda numDevices = 2
INFO 2024-07-30T12:02:30Z cuda_operators.cc:52] cuda:0 maxThreadsPerMultiProcessor = 2048
INFO 2024-07-30T12:02:30Z cuda_operators.cc:54] cuda:0 multiProcessorCount = 20
INFO 2024-07-30T12:02:30Z thread_pool.cc:73] ThreadPool started. numThreads=20
INFO 2024-07-30T12:02:30Z llm.cc:204] read model package: /home/xiaoych/.libllm/models/bilibili-index-1.9b-character-q4.llmpkg
INFO 2024-07-30T12:02:30Z model_for_generation.cc:43] model_type = index
INFO 2024-07-30T12:02:30Z model_for_generation.cc:44] device = cuda
INFO 2024-07-30T12:02:31Z state_map.cc:66] 220 tensors read.
Please input your question.
Type ' :new ' to start a new session (clean history).
Type ' :sys <system_prompt> ' to set the system prompt and start a new session .
> hi
您好!我是Index,请问有什么我可以帮助您的吗?
(12 tokens, time=0.76s, 63.47ms per token)
> $ mkdir build && cd build
$ cmake ..
$ make -jHarap menyeduh OpenMP sebelum cmake. Catatan: Saat ini libllm macos diharapkan sangat lambat karena tidak ada kernel AARCH64 untuk itu.
% brew install libomp
% export OpenMP_ROOT= $( brew --prefix ) /opt/libomp
% mkdir build && cd build
% cmake ..
% make -j Catatan: Tentukan -DCUDAToolkit_ROOT=<CUDA-DIR> Jika ada beberapa versi CUDA di OS Anda.
Rekomendasikan versi adalah:
$ mkdir build && cd build
$ cmake -DWITH_CUDA=ON [-DCUDAToolkit_ROOT =< CUDA-DIR > ] ..
$ make -j from libllm import Model , ControlToken
model = Model ( "tools/bilibili_index.llmpkg" )
prompt = [ ControlToken ( "<|reserved_0|>" ), "hi" , ControlToken ( "<|reserved_1|>" )]
for chunk in model . complete ( prompt ):
print ( chunk . text , end = "" , flush = True )
print ( " n Done!" ) package main
import (
"fmt"
"log"
"github.com/ling0322/libllm/go/llm"
)
func main () {
model , err := llm . NewModel ( "../../tools/bilibili_index.llmpkg" , llm . Auto )
if err != nil {
log . Fatal ( err )
}
prompt := llm . NewPrompt ()
prompt . AppendControlToken ( "<|reserved_0|>" )
prompt . AppendText ( "hi" )
prompt . AppendControlToken ( "<|reserved_1|>" )
comp , err := model . Complete ( llm . NewCompletionConfig (), prompt )
if err != nil {
log . Fatal ( err )
}
for comp . IsActive () {
chunk , err := comp . GenerateNextChunk ()
if err != nil {
log . Fatal ( err )
}
fmt . Print ( chunk . Text )
}
fmt . Println ()
}Berikut ini adalah contoh pengekspor model indeks-1.9b dari huggingface.
$ cd tools
$ python bilibili_index_exporter.py
-huggingface_name IndexTeam/Index-1.9B-Character
-quant q4
-output index.llmpkg
Maka semua modul yang diperlukan yang diwujudkan ke IndexTeam/Index-1.9B-Character , termasuk model, tokenizer dan konfigurasi akan ditulis ke index.llmpkg .