Skip to content
Proyek

Tentang

PasLLM - LLM inference engine in Object Pascal (synced from my private work repository)

AI dan pembelajaran mesin

Cara angka ini diukur

Yang dapat Anda lakukan

  • Pure Object Pascal - No Python or external dependencies for inference
  • Cross-Platform - Compatible with Delphi ≥11.2 and FreePascal ≥3.3.1
  • Multiple Architectures - Support for Llama, Qwen, Phi, Gemma, Mixtral, and more
  • Advanced Quantization - Custom Q4*NL formats (Q40NL, Q41NL, Q42NL, Q43NL) with superior tail reconstruction

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
Mengumpulkan riwayat
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

[!IMPORTANT] The primary repository has moved to git.rosseaux.net/BeRo1985/pasllm. This GitHub repository is kept up-to-date via push mirroring.

PasLLM

A high-performance Large Language Model inference engine written in pure Object Pascal.

Overview

PasLLM is a native Pascal implementation for running LLMs locally with optimized quantization and inference capabilities. It supports multiple model architectures and features advanced 4-bit quantization formats for efficient model deployment.

Inference runs on the CPU, on a Vulkan compute device, or on an Apple GPU through Metal. The graph planner can place a suffix of the transformer layers on the GPU and run the remaining layers on the CPU.

Features

  • Pure Object Pascal - No Python or external dependencies for inference
  • Cross-Platform - Compatible with Delphi ≥11.2 and FreePascal ≥3.3.1
  • Multiple Architectures - Support for Llama, Qwen, Phi, Gemma, Mixtral, and more
  • Advanced Quantization - Custom Q4*NL formats (Q40NL, Q41NL, Q42NL, Q43NL) with superior tail reconstruction
  • Optimized Performance - Native Pascal implementation with platform-specific optimizations
  • CLI and GUI - Both command-line interface and visual applications (FMX, VCL, LCL)

Quantization Formats

PasLLM implements several custom 4-bit and 8-bit quantization formats designed for optimal quality/size tradeoff:

  • Q40NL - 4.5 bits/weight with non-linear decode (often better than Q40)
  • Q41NL - Alternative non-linearity with increased tail emphasis
  • Q42NL - Enhanced variant with improved reconstruction
  • Q43NL - Advanced format with multiple optimization methods (gradient, coarse-fine, grid)
  • Q40 - 4 bits/weight standard quantization (matches llama.cpp Q4_0 quality)
  • Q80 - 8-bit quantization for higher quality (matches llama.cpp Q8_0 quality)
  • Q3F8 - 8x 3 bits weights + 1x 8-bit float FP8 scale per block for 4-bits/weight efficiency
  • FP8 - 8-bit floating point support
  • FP16 - 16-bit floating point support
  • BF16 - Brain Floating Point 16-bit support (basically truncated 32-bit float where the lower 16 bits are cut)
  • FP32 - Standard 32-bit floating point support (for reference and testing)

These formats achieve 99.5-99.97% of full precision quality while maintaining compact model sizes.

Supported Models

Pre-quantized models are available at https://mega.nz/folder/krcgHCpZ#0tjLqup_Hc4THWC9itDrTg, which must be placed in the bin/models/ directory. The PasLLM format covers these architectures:

  • Llama - 3/3.1/3.2 (1B, 3B, 8B variants, including abliterated/uncensored)
  • Qwen 2.5 - 0.5B, 1.5B, 3B, 7B Instruct
  • Qwen 3 - 0.6B, 1.7B, 4B, 8B, 14B, 32B (including thinking/coder/abliterated variants, 30B MoE models)
  • Phi-3 - Mini, Medium (4K context)
  • Gemma - 1.1 (2B), Gemma 2, Gemma 3
  • SmolLM 2 - 135M, 360M, 1.7B
  • SmolLM 3 - 3B
  • Mixtral - 8x7B Instruct
  • EuroMoE - 2.6B (0.6B active)
  • Apertus - 8B
  • SimpleChat - 4B, 14B
  • DeepSeek - R1 distilled variants
  • TinyLlama - 1.1B Chat

The CLI also opens Hugging Face SafeTensors directories of Llama, Mistral, Mixtral, Qwen 2 and 2.5, Qwen 3, Qwen 3 MoE and SmolLM 3, as well as GGUF files of Llama, Qwen 2 and Qwen 3. It converts them to the PasLLM format and caches the result beside the source.

These models load directly from Hugging Face SafeTensors directories or GGUF files, without conversion:

  • Qwen3.5 - 4B, 9B (text and images) Inputs and CLI examples
  • Qwen3.5, Qwen3.6, Qwen3.8 - dense 27B; Qwen3.5 and Qwen3.6 35B-A3B; Qwen3.8-Flash-Next (text and images) Placement and examples
  • Inkling - 2 Mini (text and images)
  • Ministral 3 - 3B Instruct 2512 (text and images)
  • Liquid LFM3 - 1.7B (text)
  • Gemma 4 - E4B-it (text, images and audio)

pasllmmusic and the Pascal music API render these models:

  • ACE-Step 1.5 - Turbo, XL-Base, XL-SFT Setup
  • YuE2 - 3B with its stereo decoder Setup
  • HeartMuLa - oss-3B, and MuLaCover with MIDI melody, chords and drums Setup
  • MiniMax Music 3 Setup
  • Stable Audio 3 - Small Music Base Setup

The unit PasLLM.Arch.HTDemucs separates music into stems with HTDemucs-ft for Pascal hosts.

Quick Start

Command Line Interface

# Run inference with a quantized model
./bin/pasllmcli -model=bin/models/qwen2.5_0.5b_instruct_q40nl.safetensors

# Generate with half of the transformer layers on Vulkan
./bin/pasllmcli generate --model=bin/models/smollm2_135m_instruct_q80.safetensors \
  --backend=vulkan --device-layers=half --prompt="A short story" --steps=32 --quit-after-prompt

The CLI accepts a native model file, a supported GGUF file or a local Hugging Face model directory. Qwen hybrid, Inkling, Ministral 3, Liquid LFM3 and Gemma 4 E4B read the source weights directly. The conversion path for older architectures caches its output beside the source. The LCL, VCL and FMX applications discover these sources in the models directory beside the executable.

To use checkpoints stored elsewhere, create a UTF-8 text file named models.paths beside the desktop executable. Each line maps a dropdown name to a checkpoint file or Hugging Face model directory. Relative paths start at the folder containing models.paths. For a split GGUF, point to the first shard. The selector checks for all sibling shards and skips image projectors. Keep the dropdown name when moving a checkpoint so saved chats can find it again.

Qwen3.8 Flash-Next (IQ2_XS)=/mnt/models/Qwen3.8-Flash-Next-IQ2_XS-00001-of-00002.gguf
Inkling 2 Mini=../checkpoints/Inkling-2-Mini
Liquid LFM3-1.7B=../checkpoints/LFM3-1.7B-Q4_K_M.gguf

In the desktop chat, select GPU below Tools to use Vulkan on Linux and Windows or Metal on macOS. Clear the checkbox to use the CPU. The selection takes effect on the next message and preserves the chat history. The backend and device layer settings below determine the initial selection.

Auto-compact at (%), below Context Window Size, is off by default. When enabled, the chat checks the rendered prompt after a new message or tool result. At the selected threshold (80% by default), the local model summarizes earlier turns. The current request and its tool calls stay together. The visible history keeps every message. The session file caches the summary so reopening the chat can reuse it. Turning the option off stops future summaries.

Setting CLI option Environment variable used by all four applications
Backend (default cpu) --backend=cpu|vulkan|metal PASLLM_BACKEND
Linux inference worker CPUs (default default) --cpu-cores=default|physical PASLLM_CPU_CORES
GGUF CPU decode activations (default q8_k) --cpu-activations=f32|q8_k PASLLM_CPU_ACTIVATIONS
Device layers (default all) --device-layers=all|half|N PASLLM_DEVICE_LAYERS
Vulkan device name --vulkan-device=NAME PASLLM_VULKAN_DEVICE
Qwen hybrid and Inkling placement (default layers) --language-placement=layers|tiered PASLLM_LANGUAGE_PLACEMENT
Routed expert cache (default 128 MiB) --expert-cache-mib=N PASLLM_EXPERT_CACHE_MIB
Dense GPU weight cache (default auto) --dense-cache-mib=auto|N PASLLM_DENSE_CACHE_MIB
GGUF vision projector --mmproj=FILE PASLLM_MMPROJ

An explicit CLI option overrides the corresponding environment variable. Metal requires macOS. Use --help to print the inference options.

On Linux, --cpu-cores=physical uses one worker per physical core available to the inference thread. Workers share a CPU set containing one allowed hardware thread per core. The Linux desktop checkbox Physical CPU cores (next start) saves the choice for the next launch. An existing desktop preference takes precedence over the environment. Pascal hosts can pass their own pool to TPasLLM.Create or set TPasLLMApplicationOptions.CPUCores to physical and call AcquireWorkerPool(OwnedPool). Free OwnedPool after the inference instance. With default, the application uses the shared PasMP pool.

By default, the CLI and desktop use Q8_K activations for single-token CPU projections with Q4_K or Q6_K weights. This can change logits and generated tokens. Set PASLLM_CPU_ACTIVATIONS=f32 or pass --cpu-activations=f32 to use FP32 activations. Pascal hosts creating TPasLLM directly can enable the same Q8_K path with CPUQ8KActivations:=true before creating the inference instance.

Compact chat models

Checkpoint Inputs through the Pascal API and CLI GGUF companion file
Qwen3.5-4B, Qwen3.5-9B Text and images Matching Qwen vision projector for images
Ministral 3 3B Instruct 2512 Text and images Matching Pixtral projector for images
Liquid LFM3-1.7B Text None
Gemma 4 E4B-it Text, images and audio Matching Gemma 4 multimodal projector for images and audio

These models accept local Hugging Face SafeTensors directories and quantized GGUF checkpoints. The desktop model selector opens them for text chat and tool calls. The CLI accepts ordered image and audio attachments with generate. Gemma reads the first 30 seconds of each PCM or float32 WAV.

./bin/pasllmcli generate --model="$GEMMA4_GGUF" --backend=vulkan \
  --audio=take.wav --prompt="Transcribe the words in this recording." --steps=128

In Pascal, encode the conversation with Model.Tokenizer.EncodeChat(Messages). Use content parts with type set to text, image or audio. Pass the images and audio clips in their order of appearance within each type to ForwardMultimodal(Tokens, Images, Audio, Position, NextPosition). Each TPasLLMLanguageAudio contains mono floating-point Samples and their SampleRate in Hz. Continue generating at NextPosition after the expanded media sequence.

Qwen hybrid and Inkling text and image models

The Qwen hybrid decoder also supports Qwen3.5, Qwen3.6 and Qwen3.8 dense 27B, Qwen3.5 and Qwen3.6 35B-A3B, Qwen3.8-Flash-Next, and a separate decoder supports Inkling 2 Mini. Qwen identifies 3.5-35B-A3B as the open-weight counterpart of its hosted Flash model. Qwen3.5-35B-A3B model card

Pass the Hugging Face directory containing the weights, configuration and tokenizer, or a GGUF shard with its siblings in the same directory. For images, the GGUF decoder uses a matching vision projector. Use --mmproj to select it explicitly. The HF releases include the vision weights. The Qwen loader also reads the published block-scaled FP8 layout. The Inkling loader supports its ModelOpt NVFP4 and MXFP8 experts.

./bin/pasllmcli chat --model="$FLASH_GGUF" --backend=vulkan \
  --language-placement=tiered --device-layers=all --expert-cache-mib=128 --dense-cache-mib=128

./bin/pasllmcli generate --model="$QWEN_HF_DIR" --backend=vulkan --device-layers=half \
  --image=photo.jpg --prompt="Describe the scene." --steps=48
  • Layer split. layers places the linear projections of the requested suffix of decoder layers on the GPU. Earlier layers use the CPU. Routing, recurrent updates and attention bookkeeping run on the host. The dense cache retains eligible projection weights on the device up to its budget. Setting its size to zero streams dense weights in tiles.
  • Tiered experts. tiered uses the same layer boundary. The CPU processes cold routed expert tiles. Repeatedly requested tiles enter a bounded least-recently-used cache and use the device assigned to the layer. The expert budget counts decoded FP32 weights in RAM. GPU-placed expert tiles can also occupy up to that amount of VRAM. A zero expert budget keeps routed expert calculations on the CPU and lets eligible dense projections use the GPU. The Flash n-gram lookup reads the selected rows from the checkpoint in both modes.

During single-token GPU decoding, eligible dense Q4_K and Q6_K GGUF matrices stay packed. The kernel decodes each superblock during the dot product and accumulates in FP32. The automatic dense cache (Pascal DenseCacheMiB := -1) shares the device budget between packed matrices and native FP32 GGUF weights, including Inkling's router and loop-control matrices. It reserves up to 2 GiB for other device allocations. Other dense projections retain the 128 MiB default. An explicit size caps the combined dense cache. Zero streams weights on each pass.

These sizes apply per inference instance. Activations, recurrent state, KV history, backend scratch buffers and the operating system's file cache use additional memory. The implementation issues the CPU and GPU projections in sequence. Use --placement-stats to print measured CPU/GPU projection counts, cache hits and retained bytes on exit. Throughput depends on storage, memory bandwidth, quantization and context length.

For Pascal callers, set BackendType, DeviceLayers, LanguagePlacement, ExpertCacheMiB and DenseCacheMiB on TPasLLM before creating the inference instance. Use Model.Tokenizer.EncodeChat(Messages) with text and image content parts. Pass the token array and the ordered RGB8 images to ForwardMultimodal(Tokens, Images, Position, NextPosition). It returns the logits for the next token. Continue with Forward(Token, NextPosition, false). The expanded grid determines NextPosition. LanguagePlacementStats reports projection counts, cache hits and bytes for the instance.

Generate music with ACE-Step

pasllmmusic turns a description into a 48 kHz stereo WAV using ACE-Step 1.5. On Linux, build with Free Pascal and the project submodules. Set ACESTEP_CHECKPOINTS to the directory containing Qwen3-Embedding-0.6B/, vae/ and the chosen model's directory with its weights and silence_latent.pt.

Pascal applications can call PasLLM.Music to render ACE-Step, YuE2, HeartMuLa, MuLaCover, MiniMax Music 3 or Stable Audio 3 Small Music Base into a stereo buffer. The returned SampleRate gives the playback rate. YuE2 also accepts a piano-roll score in musical ticks or ABC text. Pascal host API and example

mkdir -p build/music
fpc -O3 -Fisrc -Fusrc -Fusrc/synapse -Fuexternals/pinja/src -Fuexternals/pasdblstrutils/src \
  -Fuexternals/pasjson/src -Fuexternals/pasmp/src -Fuexternals/flre/src -Fuexternals/gusl/src \
  -FUbuild/music -FEbin src/pasllmmusic/pasllmmusic.dpr
export ACESTEP_CHECKPOINTS=/path/to/ACE-Step-1.5/checkpoints
./bin/pasllmmusic --backend=vulkan --prompt="Warm electric piano, upright bass and brushed drums" \
  --bpm=96 --duration=10 --seed=42 --output=jazz.wav

For non-Turbo generation, select --model=xl-sft or --model=xl-base. The CLI loads the four weight shards using the index in the chosen model directory.

Omit --duration to let the local 5-Hz language model predict the song length from the description and lyrics before diffusion. A supplied --bpm also conditions that prediction. The CLI looks for acestep-5Hz-lm-1.7B/, then acestep-5Hz-lm-4B/, under the checkpoints directory. With neither LM installed it reports the upstream fallback of 120 seconds. An explicit duration skips the language model.

Model option Checkpoint directory Default diffusion steps Allowed --steps
turbo (default) acestep-v15-turbo/ 8 1–20
xl-base acestep-v15-xl-base/ 32 1–200
xl-sft acestep-v15-xl-sft/ 50 1–200
./bin/pasllmmusic --model=xl-sft --backend=vulkan --duration=10 --seed=42 \
  --prompt="Warm electric piano, upright bass and brushed drums" --output=jazz-xl-sft.wav

By default the CLI generates an instrumental on the CPU. For vocals, add --lyrics-file=lyrics.txt --language=de or pass the lyrics directly with --lyrics="...". The CLI prints the seed and reports each completed diffusion step and the elapsed diffusion time on stderr. A successful run replaces the requested WAV and prints its path on stdout.

Generate music with YuE2

The same Linux executable also runs YuE2-3B and its stereo decoder natively on CPU or Vulkan. It reads the two models from the local Hugging Face cache. For standalone checkpoints, pass --checkpoints=/path/to/models with YuE2-3B/ and YuE2-Vae/ underneath. The 3B directory must also contain the original qwen.tiktoken.

./bin/pasllmmusic --model=yue2 --backend=vulkan --seed=42 \
  --prompt="German melodic heavy metal, powerful female lead, twin guitars, 148 BPM" \
  --lyrics=$'[Verse]\nAus dunklem Stahl erwacht das Licht\n[Chorus]\nWir brechen durch die Nacht' \
  --output=stahllicht.wav

The default --plan=off generates music directly. Use --plan=melody to generate an ABC melody first or --plan=full for a score with chord symbols. To supply your own score, pass --abc-file=score.abc. Use --lyrics-file=lyrics.txt for longer lyrics. Include the vocal language and tempo in the style prompt.

By default YuE2 generates until it emits its music end token, with the original budget of 9,000 semantic tokens (360 seconds). The end token becomes available after 200 music tokens (8 seconds). To request a shorter maximum, pass e.g. --duration=30. The CLI reports whether the model ended the song or reached the limit. The acoustic solver defaults to 32 midpoint steps. To render a saved YuE2 performance, only the decoder weights are needed.

./bin/pasllmmusic --model=yue2 --backend=vulkan --latents=latent.npy --output=render.wav

Generate vocals with HeartMuLa and MuLaCover

Both models take style tags and lyrics and produce 48 kHz stereo audio. Set HEARTMULA_CHECKPOINTS or pass --checkpoints to select the checkpoint directory. HeartMuLa reads HeartMuLa-oss-3B/, tokenizer.json and HeartCodec-oss/ from that directory. MuLaCover reads MuLaCover/, Qwen3-Embedding-0.6B/ and the same codec. The Pascal renderer runs locally on CPU or with Vulkan acceleration.

export HEARTMULA_CHECKPOINTS=/path/to/HeartMuLa/ckpt
./bin/pasllmmusic --model=heartmula --backend=vulkan --seed=42 \
  --prompt="melodic metal,harmonized guitars,spanish,female vocals" \
  --lyrics=$'[Verse]\nCanta la noche, despierta el mar\n[Chorus]\nVuelve la luz' \
  --output=canta.wav

./bin/pasllmmusic --model=mulacover --backend=vulkan --seed=42 \
  --prompt="acoustic folk, warm lead vocal" --lyrics-file=lyrics.txt \
  --melody-midi=melody.mid --chord-midi=chords.mid --output=cover.wav

Omit --duration to let the model end the song. The default maximum is 120 seconds for HeartMuLa and 300 seconds for MuLaCover, subject to the remaining context. Set --duration=30 to cap generation at 30 seconds. Both models emit eight codes per 80 ms frame. HeartCodec uses ten diffusion steps by default. Before the first audio frame, the CLI reports progress loading the 28 backbone layers and processing the prompt through both guidance passes. It then reports generated frames and completed diffusion steps.

For HeartMuLa, put short, comma-separated style tags in --prompt and the words to sing in --lyrics or --lyrics-file. Separate sections with headings such as [Verse] and [Chorus]. The CLI and host API default to a song guidance scale of 3.0 for HeartMuLa and 1.5 for MuLaCover. Use --cfg-scale=1.5 or TPasLLMMusicRequest.GuidanceScale to change it. A scale of 1 runs the conditioned pass alone. HeartMuLa input examples · Upstream generation CLI

MuLaCover accepts a required melody and optional chord and drum files in Standard MIDI File format 0 or 1. Use --drum-midi=drums.mid for percussion. DAW hosts can pass the three tracks directly in TPasLLMMusicRequest.NoteTracks, with an independent ticks-per-quarter value for each track. The model conditions on a sixteenth-note grid, melody onsets and sustains, drum hits and chord pitch classes. Rendering can vary from the score in performance timing. Include the intended tempo and vocal language in the style tags.

MuLaCover by MuLa Labs licenses the weights under CC BY-NC 4.0. Commercial use of the weights or generated music requires separate written authorization. MuLaCover · Model and output terms

Generate vocals with MiniMax Music 3

Set MINIMAX_MUSIC3_CHECKPOINTS to the root of the MiniMax Music 3 checkpoint, alongside its tokenizer/, language_model/, rvq_depth_decoder/, condition_encoder/, transformer/ and vocoder/ directories. Describe the genre, tempo, language, voice and instrumentation in the caption. Put the words to sing in a UTF-8 lyrics file, with section headings such as [Verse] and [Chorus] on separate lines. MiniMax model and caption guide

export MINIMAX_MUSIC3_CHECKPOINTS=/path/to/MiniMax-Music3
./bin/pasllmmusic --model=minimax-music3 --backend=vulkan --seed=1414124 \
  --prompt="Industrial heavy metal, 136 BPM. German alto vocals, palm-muted guitars and double kick drums." \
  --lyrics-file=lyrics.txt --output=song.wav

Without --duration, the model can sing through to its end token, up to five minutes or the remaining context. Use --duration=40 for a preview. The flow decoder defaults to 30 steps per window. The native vocoder produces 44.1 kHz stereo. DAWs can select TPasLLMMusicModel.MiniMaxMusic3, pass Caption and Lyrics to PasLLMGenerateMusic, and use the existing progress and cancellation callbacks.

Generate an instrumental with Stable Audio 3

--model=stable-audio-3 selects Small Music Base. Point STABLE_AUDIO3_CHECKPOINTS or --checkpoints at the directory containing model_config.json, model.safetensors and the t5gemma-b-b-ul2/ text encoder. Describe the genre, instruments, tempo and arrangement in the prompt. Small Music Base checkpoint · Prompting guide

export STABLE_AUDIO3_CHECKPOINTS=/path/to/Stable-Audio-3/small-music-base
./bin/pasllmmusic --model=stable-audio-3 --backend=vulkan --duration=24 --seed=1414124 \
  --prompt="TrackType: Music, industrial heavy metal instrumental, 136 BPM, D minor. Four-note riff on palm-muted guitars, grinding bass and double kick drums." \
  --output=metal-instrumental.wav

The requested length is fixed at 1–120 seconds, with 120 seconds, 50 Euler steps and guidance 7.0 as defaults. The output is 44.1 kHz stereo. In the host API, select TPasLLMMusicModel.StableAudio3SmallMusic, put the prompt in Caption and leave Lyrics empty. The port is awaiting its first end-to-end comparison with the original weights.

Building from Source

FreePascal:

git submodule update --init --recursive
mkdir -p build/cli
fpc -O3 -Fisrc -Fusrc -Fusrc/synapse -Fuexternals/pinja/src -Fuexternals/pasdblstrutils/src \
  -Fuexternals/pasjson/src -Fuexternals/pasmp/src -Fuexternals/flre/src -Fuexternals/gusl/src \
  -FUbuild/cli -FEbin src/pasllmcli/pasllmcli.dpr

The Lazarus and Delphi projects under src/ set these unit search paths themselves.

Delphi: Open src/pasllmcli/pasllmcli.dproj in Delphi IDE and build.

Project Structure

src/
  ├── PasLLM.pas              # Core inference engine
  ├── PasLLMChatControl.pas   # Chat interface control
  ├── pasllmcli/              # Command-line interface
  ├── pasllmappfmx/           # FireMonkey GUI app
  ├── pasllmappvcl/           # VCL GUI app
  └── pasllmapplcl/           # Lazarus LCL GUI app
tools/
  └── convert.py              # Model conversion utilities
docs/
  └── quant_4bit_formats.md   # Detailed format specifications

Conversion of Models

Models from Hugging Face can be converted to PasLLM format using the convert.py script in the tools/ directory. Example usage:

cd ${modelpath}

# Q40NL conversion example
python ${pasllmbasepath}/tools/convert.py --config config.json --tokenizer tokenizer.json --models model*.safetensors --dtype q40nl --cpu ${pasllmbasepath}/bin/models/${modelname}_q40nl.safetensors

# Q41NL conversion example
python ${pasllmbasepath}/tools/convert.py --config config.json --tokenizer tokenizer.json --models model*.safetensors --dtype q41nl --cpu ${pasllmbasepath}/bin/models/${modelname}_q41nl.safetensors 

# Q42NL conversion example
python ${pasllmbasepath}/tools/convert.py --config config.json --tokenizer tokenizer.json --models model*.safetensors --dtype q42nl --cpu ${pasllmbasepath}/bin/models/${modelname}_q42nl.safetensors

# Q43NL conversion example
python ${pasllmbasepath}/tools/convert.py --config config.json --tokenizer tokenizer.json --models model*.safetensors --dtype q43nl --cpu ${pasllmbasepath}/bin/models/${modelname}_q43nl.safetensors

# Q40 conversion example
python ${pasllmbasepath}/tools/convert.py --config config.json --tokenizer tokenizer.json --models model*.safetensors --dtype q40 --cpu ${pasllmbasepath}/bin/models/${modelname}_q40.safetensors

# Q80 conversion example
python ${pasllmbasepath}/tools/convert.py --config config.json --tokenizer tokenizer.json --models model*.safetensors --dtype q80 --cpu ${pasllmbasepath}/bin/models/${modelname}_q80.safetensors

# Q3F8 conversion example
python ${pasllmbasepath}/tools/convert.py --config config.json --tokenizer tokenizer.json --models model*.safetensors --dtype q3f8 --cpu ${pasllmbasepath}/bin/models/${modelname}_q3f8.safetensors

# FP8 conversion example
python ${pasllmbasepath}/tools/convert.py --config config.json --tokenizer tokenizer.json --models model*.safetensors --dtype fp8 --cpu ${pasllmbasepath}/bin/models/${modelname}_fp8.safetensors

# FP16 conversion example
python ${pasllmbasepath}/tools/convert.py --config config.json --tokenizer tokenizer.json --models model*.safetensors --dtype fp16 --cpu ${pasllmbasepath}/bin/models/${modelname}_fp16.safetensors

# and so on for BF16 and FP32...

Documentation

License

Dual-licensed under:

  • AGPL 3.0 for open-source use
  • Commercial license available for proprietary applications (contact: [email protected])

Author

Benjamin Rosseaux (BeRo)
GitHub: @BeRo1985
Contact: [email protected]

Additional Information

  • Code is compatible with both Delphi ≥11.2 and FreePascal ≥3.3.1
  • Compiles on 32-bit and 64-bit platforms (x86-32, x86-64, ARM, ARM64), but 64-bit is preferred due to model sizes (32-bit may run out of memory). The 64-bit targets are more tested and verified. 32-bit support is unofficial and at your own risk.
  • No platform-specific or third-party dependencies (unless out-ifdef-able)

Jelajahi proyek terkait

Memuat…