Instructions to use AfkaraLP/rustlean-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AfkaraLP/rustlean-gguf with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AfkaraLP/rustlean-gguf", device_map="auto") - llama-cpp-python
How to use AfkaraLP/rustlean-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="AfkaraLP/rustlean-gguf", filename="rustlean-final.Q8_0.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use AfkaraLP/rustlean-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf AfkaraLP/rustlean-gguf:Q8_0 # Run inference directly in the terminal: llama cli -hf AfkaraLP/rustlean-gguf:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AfkaraLP/rustlean-gguf:Q8_0 # Run inference directly in the terminal: llama cli -hf AfkaraLP/rustlean-gguf:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf AfkaraLP/rustlean-gguf:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf AfkaraLP/rustlean-gguf:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf AfkaraLP/rustlean-gguf:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf AfkaraLP/rustlean-gguf:Q8_0
Use Docker
docker model run hf.co/AfkaraLP/rustlean-gguf:Q8_0
- LM Studio
- Jan
- Ollama
How to use AfkaraLP/rustlean-gguf with Ollama:
ollama run hf.co/AfkaraLP/rustlean-gguf:Q8_0
- Unsloth Studio
How to use AfkaraLP/rustlean-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AfkaraLP/rustlean-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AfkaraLP/rustlean-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for AfkaraLP/rustlean-gguf to start chatting
- Atomic Chat new
- Docker Model Runner
How to use AfkaraLP/rustlean-gguf with Docker Model Runner:
docker model run hf.co/AfkaraLP/rustlean-gguf:Q8_0
- Lemonade
How to use AfkaraLP/rustlean-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AfkaraLP/rustlean-gguf:Q8_0
Run and chat with the model
lemonade run user.rustlean-gguf-Q8_0
List all available models
lemonade list
| license: apache-2.0 | |
| tags: | |
| - fill-in-the-middle | |
| - code | |
| - rust | |
| - llama-cpp | |
| - gguf | |
| base_model: Qwen/Qwen2.5-Coder-1.5B | |
| library_name: transformers | |
| # RustLean v4 (GGUF) | |
| RustLean v4 is a Rust-specialized, native fill-in-the-middle (FIM) completion | |
| model based on | |
| [`Qwen/Qwen2.5-Coder-1.5B`](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B). | |
| This repository ships a merged `Q8_0` GGUF with no runtime LoRA dependency. | |
| The release uses 50% of the selected step-1100 LoRA delta. The full adapter had | |
| strong completion metrics but regressed deterministic HumanEvalPack-Rust. The | |
| interpolated release retained its measured AST and out-of-distribution exact | |
| match while recovering the base model's compiler-tested pass rate. | |
| ## Model Details | |
| | Property | Value | | |
| |---|---| | |
| | Base | `Qwen/Qwen2.5-Coder-1.5B` | | |
| | Architecture | Qwen2 decoder, 28 layers, width 1,536 | | |
| | Attention | 12 query heads, 2 KV heads (GQA) | | |
| | Parameters | Approximately 1.54B | | |
| | Context | 32,768 tokens native; trained and evaluated at 1,024 | | |
| | Adapter | Rank-32 LoRA on attention and MLP projections | | |
| | Training | 1,200 optimizer steps, approximately 10.5M processed tokens | | |
| | Release delta | 0.5 times the step-1100 adapter delta, merged into fp16 | | |
| | Artifact | `rustlean-v4.Q8_0.gguf`, approximately 1.64 GB | | |
| ## Training Data | |
| The licensed Rust corpus contains 58,407 training chunks from 1,048 repository | |
| families and 3,044 holdout chunks from 73 unseen families. Repository families | |
| are disjoint between training and evaluation. HumanEvalPack-Rust and MultiPL-E | |
| prompts, tests, and canonical solutions were excluded from training. | |
| Each source training chunk produced three FIM views and one left-to-right replay | |
| row. The final mixture contains: | |
| | Objective | Rows | | |
| |---|---:| | |
| | Total | 217,727 | | |
| | FIM | 159,320 | | |
| | Left-to-right | 58,407 | | |
| | AST-boundary holes | 121,835 | | |
| | Random editor holes | 37,485 | | |
| | Empty-suffix prefix completions | 49,644 | | |
| There are no duplicate FIM objectives. Exact duplicates were also removed | |
| across the train and holdout source splits. | |
| ## Prompt Format | |
| Use Qwen's PSM FIM format: | |
| ```text | |
| <|fim_prefix|>{prefix}<|fim_suffix|>{suffix}<|fim_middle|> | |
| ``` | |
| For ordinary cursor completion, leave the suffix empty: | |
| ```text | |
| <|fim_prefix|>fn add(a: i32, b: i32) -> i32 { | |
| <|fim_suffix|><|fim_middle|> | |
| ``` | |
| Stop at `<|endoftext|>`, `<|fim_prefix|>`, `<|fim_suffix|>`, | |
| `<|fim_middle|>`, or `<|fim_pad|>`. | |
| The same prefix-completion format is embedded as the GGUF chat template. | |
| ## Evaluation | |
| All completion results below use greedy generation, a 1,024-token input crop, | |
| a fixed 256-token generation budget, and control-token trimming. Private | |
| results use the first 200 deterministic examples from repository-family- | |
| disjoint holdouts. | |
| | Model | Private AST exact | Similarity | Parse rate* | | |
| |---|---:|---:|---:| | |
| | Qwen2.5-Coder-1.5B | 22.5% | 0.465 | 71.88% | | |
| | Previous RustLean | 31.5% | 0.647 | 81.25% | | |
| | **RustLean v4** | **35.0%** | **0.680** | **84.38%** | | |
| | Model | OOD exact, 95 tasks | Similarity | Parse rate* | | |
| |---|---:|---:|---:| | |
| | Previous RustLean | 30.53% | **0.793** | 95.24% | | |
| | **RustLean v4** | **35.79%** | 0.781 | **100%** | | |
| `*` Parse rate is measured only where the original reconstructed source is | |
| parseable, so its denominator is smaller than the row count. | |
| Deterministic HumanEvalPack-Rust uses 164 tasks, one greedy empty-suffix FIM | |
| completion per task, Rust 1.95, and execution-backed tests: | |
| | Model | Passing tasks | pass@1 | | |
| |---|---:|---:| | |
| | Qwen2.5-Coder-1.5B | 48/164 | 29.27% | | |
| | Full step-1100 adapter | 35/164 | 21.34% | | |
| | **RustLean v4, 0.5 delta** | **48/164** | **29.27%** | | |
| HumanEvalPack is evaluation-only. No synthesis improvement over the base model | |
| is claimed. | |
| ## Usage | |
| ### llama.cpp | |
| ```bash | |
| llama-server -m rustlean-v4.Q8_0.gguf | |
| ``` | |
| For raw CLI completion: | |
| ```bash | |
| llama-cli -m rustlean-v4.Q8_0.gguf --no-conversation -e \ | |
| -p '<|fim_prefix|>fn main() {<|fim_suffix|><|fim_middle|>' | |
| ``` | |
| ### llama-cpp-python | |
| ```python | |
| from llama_cpp import Llama | |
| llm = Llama(model_path="rustlean-v4.Q8_0.gguf", n_ctx=8192, n_gpu_layers=-1) | |
| prompt = "<|fim_prefix|>fn add(a: i32, b: i32) -> i32 {\n <|fim_suffix|><|fim_middle|>" | |
| result = llm( | |
| prompt, | |
| max_tokens=96, | |
| temperature=0.2, | |
| stop=["<|endoftext|>", "<|fim_prefix|>", "<|fim_suffix|>", "<|fim_middle|>", "<|fim_pad|>"], | |
| ) | |
| print(result["choices"][0]["text"]) | |
| ``` | |
| ## Files | |
| - `rustlean-v4.Q8_0.gguf`: merged Q8_0 model with embedded FIM template. | |
| - `rustlean-v4.jinja`: standalone copy of the FIM template. | |
| GGUF SHA-256: | |
| `47dc21750adee427aae050c0c44c7bd78e63c2792b9230e18bc35471453ec694` | |
| ## License | |
| Apache-2.0, inherited from `Qwen/Qwen2.5-Coder-1.5B`. | |