


Willkommen bei LIBLLM, einem Open-Source-Projekt, das für eine effiziente Inferenz von LLM-Modellen (Language Models) auf normalen PCs und mobilen Geräten entwickelt wurde. Der Kern ist in C ++ 14 implementiert, ohne Abhängigkeiten von Drittanbietern (wie BLAS oder Satzwerk), wodurch der nahtlose Betrieb auf verschiedenen Geräten ermöglicht wird.
Willkommen bei LIBLLM, einem Open -Source -Projekt, das für eine effiziente Schlussfolgerung von großen Sprachmodellen (LLM) auf durchschnittliche PCs und mobile Geräte entwickelt wurde. Der Kern ist in C ++ 14 geschrieben und hat keine Abhängigkeiten von Drittanbietern (BLAS, Satzstück usw.) und kann in verschiedenen Geräten nahtlos laufen.
| Modell | Herunterladen | LLM -Befehl |
|---|---|---|
| Index-1.9b-Charakter (Rollenspiel) | [? HF] [MS] | LLM CHAT -M -Index: Zeichen |
| INDEX-1.9B-CHAT | [? HF] [MS] | LLM -Chat -m -Index |
| Qwen2-1.5b-instruct | [? HF] [MS] | LLM CHAT -M QWEN: 1,5B |
| Qwen2-7b-instruct | [? HF] [MS] | llm chat -m qwen: 7b |
| LAMA3.2-1B-Instruct | [? HF] [MS] | LLM CHAT -M LLAMA3.2: 1B |
| LAMA3.2-3B-ISTRUCT | [? HF] [MS] | LLM CHAT -M LLAMA3.2 |
| Flüsterlarge-v3 | [? HF] [MS] | llm transkricle -m flüstern |
HF = Suggingface, MS = ModelsCope
| Betriebssystem | Plattform | CUDA | AVX2 | AVX512 | ASIMDHP |
|---|---|---|---|---|---|
| Linux | x64 | ✅ | ✅ | ✅ | |
| Fenster | x64 | ✅ | ✅ | ✅ | |
| macos | ARM64 | ✅ |
llm chat -model index-character das index-character Modell automatisch von "HuggingFace" herunter. Bilibili-Index-1.9b-Charakter ausführen und mit Bilibili-Index-1.9b-Charakter chatten:
$ llm chat -m index-character Es wird automatisch den Bilibili-Index-1.9B-Character von Huggingface oder ModelsCope (in China) heruntergeladen und die Chat-CLI in LLM starten.
Chat mit Bilibili-Index-1.9B-Character Modell:
$ llm chat -m index-character llm lädt das Modell Bilibili-Index-1.9B-Character automatisch von Huggingface oder ModelsCope (falls es sich um chinesische IP) aus und beginnt mit ihm zu sprechen.
$ 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 -jBitte brauen Sie die Installation von OpenMP vor CMAKE. HINWEIS: Derzeit erwartet LIBLLM MACOS sehr langsam, da es keinen AARG64 -Kernel dafür gibt.
% brew install libomp
% export OpenMP_ROOT= $( brew --prefix ) /opt/libomp
% mkdir build && cd build
% cmake ..
% make -j Hinweis: Geben Sie -DCUDAToolkit_ROOT=<CUDA-DIR> an, wenn in Ihrem Betriebssystem mehrere CUDA -Versionen enthalten sind.
Empfehlen Versionen sind:
$ 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 ()
}Hier ist ein Beispiel für das Exportieren von Index-1.9b-Modell aus dem Umarmungsface.
$ cd tools
$ python bilibili_index_exporter.py
-huggingface_name IndexTeam/Index-1.9B-Character
-quant q4
-output index.llmpkg
Anschließend alle erforderlichen Module, die in IndexTeam/Index-1.9B-Character realisiert wurden, einschließlich Modell, Tokenizer und Konfigurationen werden in index.llmpkg geschrieben.