Lag Llama GGUF
Pure Rust converter and inference engine for time-series-foundation-models/Lag-Llama.
Modellquelle
- Art
- Other
- Dateigröße
- 4,68–9,35 MB
- Basismodell
- time-series-foundation-models/Lag-Llama
- Version
- vRevision 6d81446
- Aktualisiert
- 14. Sept. 2026
- Verleger
- @amaye15
- Downloads
- 35
- Quelle
- Hugging Face
Quellenbeschreibung
lag-llama-rs
Pure Rust converter and inference engine for time-series-foundation-models/Lag-Llama.
Pre-converted GGUF files are available at amaye15/lag-llama-gguf. Produces GGUF v3 files and runs native forecasting — no Python required.
Build
cargo build --release
Convert
Downloads lag-llama.ckpt from HuggingFace and converts it directly via candle's pickle reader — no Python or intermediate extraction step required:
# F16 (recommended)
./target/release/lag-llama-rs convert --model time-series-foundation-models/Lag-Llama --dtype f16 --output gguf/lag_llama-f16.gguf
# Q8_0 (smallest)
./target/release/lag-llama-rs convert --dtype q8 --output gguf/lag_llama-q8.gguf
# F32 (full precision)
./target/release/lag-llama-rs convert --dtype f32 --output gguf/lag_llama-f32.gguf
To convert all dtypes at once:
./scripts/convert_all.sh
HuggingFace token (optional for public models):
HF_TOKEN=hf_... ./scripts/convert_all.sh
Inspect tensors
Print all tensor names and shapes from a .safetensors checkpoint:
./target/release/lag-llama-rs inspect-tensors models/model.safetensors
Infer
Run point forecasting from comma-separated context values:
echo '{"context": [1.0, 1.2, 1.5, 1.3, 1.8, 2.0, 1.9, 2.1], "horizon": 96}' \
| ./target/release/lag-llama-rs infer --gguf gguf/lag_llama-f16.gguf
Output is JSON in an OpenAI-compatible forecast format:
{
"id": "forecast-000001932b7a1234",
"object": "forecast",
"created": 1749686400,
"model": "lag-llama",
"choices": [{
"index": 0,
"forecast": {
"point": [2.1, 2.3, 2.5, "..."],
"quantiles": {}
},
"finish_reason": "stop"
}],
"usage": {"context_length": 8, "forecast_length": 96}
}
Batch inference — pass multiple series as a nested array to get one Choice per series:
echo '{"context": [[1.0, 1.2, 1.5], [2.0, 2.2, 2.5]], "horizon": 96}' \
| ./target/release/lag-llama-rs infer --gguf gguf/lag_llama-f16.gguf
Python bindings
Install with maturin inside a virtual environment:
python -m venv .venv && source .venv/bin/activate
pip install maturin
maturin develop --features python
import lag_llama_rs
model = lag_llama_rs.LagLlama("gguf/lag_llama-f16.gguf")
result = model.forecast([1.0, 1.2, 1.5, 1.3, 1.8, 2.0], horizon=96)
point = result["choices"][0]["forecast"]["point"]
# Batch — one Choice per series
result = model.forecast([[1.0, 1.2, 1.5], [2.0, 2.2, 2.5]], horizon=96)
forecast returns a Python dict in the same OpenAI-compatible format as the CLI.
Architecture notes
Lag-Llama is a LLaMA-style autoregressive decoder for time series:
- Input: Lagged values of the target series are appended as covariates alongside the most-recent context, giving the model a multi-scale view of the history
- Backbone: Standard LLaMA decoder (RoPE, causal self-attention, SwiGLU FFN)
- Output: Point forecast for each future timestep via autoregressive decoding
- Checkpoint: Reads
.ckpt(PyTorch Lightning pickle) directly — no Python required
Quellen
1 Quelle
Quellen
1 QuelleVerifiziert 9. Aug.
Modellartefakte
3 Artefakte
Modellartefakte
3 Artefaktelag-llama-rs/gguf/lag_llama-f16.gguf
gguf · 4,68 MB · SHA-256 b7da4506d6a6…0db6 · Hugging Face
Herunterladenlag-llama-rs/gguf/lag_llama-f32.gguf
gguf · 9,35 MB · SHA-256 b939f68cc294…b384 · Hugging Face
Herunterladenlag-llama-rs/gguf/lag_llama-q8.gguf
gguf · 7,70 MB · SHA-256 8ad8fb2fd2a9…bae1 · Hugging Face
HerunterladenQuellenauszüge
3 Auszüge
Quellenauszüge
3 Auszüge--- license: mit library_name: gguf pipeline_tag: time-series-forecasting language: - en base_model: time-series-foundation-models/Lag-Llama base_model_relation: quantized quantized_by: amaye15 tags: - gguf - time-series - forecasting - zero-shot - autoregressive - llm - rust inference: false --- # lag-llama-rs Pure Rust converter and inference engine for [time-series-foundation-models/Lag-Llama](https://huggingface.co/time-series-foundation-models/Lag-Llama). Pre-converted GGUF files are available at [amaye15/lag-llama-gguf](https://huggingface.co/amaye15/lag-llama-gguf). Produces GGUF v3 files and runs native forecasting — no Python required. ## Build ```bash cargo build --release ``` ## Convert Downloads `lag-llama.ckpt` from HuggingFace and converts it directly via candle's pickle reader — no Python or intermediate extraction step required: ```bash # F16 (recommended) ./target/release/lag-llama-rs convert --model time-series-foundation-models/Lag-Llama --dtype f16 --output gguf/lag_llama-f16.gguf # Q8_0 (smallest) ./target/release/lag-llama-rs convert --dtype q8 --output gguf/lag_llama-q8.gguf # F32 (full precision) ./target/release/lag-llama-rs convert --dtype f32 --output gguf/lag_llama-f32.gguf ``` To convert all dtypes at once: ```bash ./scripts/convert_all.sh ``` HuggingFace token (optional for public models): ```bash HF_TOKEN=hf_... ./scripts/convert_all.sh ``` ## Inspect tensors Print all tensor names and shapes from a `.safetensors` checkpoint: ```bash ./target/release/lag-llama-rs inspect-tensors models/model.safetensors ``` ## Infer Run point forecasting from comma-separated context values: ```bash echo '{"context": [1.0, 1.2, 1.5, 1.3, 1.8, 2.0, 1.9, 2.1], "horizon": 96}' \ | ./target/release/lag-llama-rs infer --gguf gguf/lag_llama-f16.gguf ``` Output is JSON in an OpenAI-compatible forecast format: ```json { "id": "forecast-000001932b7a1234", "object": "forecast", "created": 1749686400, "model": "lag-llama", "choices": [{ "index": 0, "forecast": { "point": [2.1, 2.3, 2.5, "..."], "quantiles": {} }, "finish_reason": "stop" }], "usage": {"context_length": 8, "forecast_length": 96} } ``` **Batch inference** — pass multiple series as a nested array to get one `Choice` per series: ```bash echo '{"context": [[1.0, 1.2, 1.5], [2.0, 2.2, 2.5]], "horizon": 96}' \ | ./target/release/lag-llama-rs infer...
Source context: 35 downloads · 0 likes · Pipeline time-series-forecasting · Library gguf · Repo amaye15/lag-llama-gguf
Source context: 151 downloads · 0 likes · Pipeline time-series-forecasting · Library gguf · Repo amaye15/lag-llama-gguf
