Deploy RustLean v4 GGUF
Browse files- .env.example +1 -1
- README.md +6 -4
- app.py +6 -4
.env.example
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
HF_TOKEN=hf_xxx
|
| 2 |
# MODEL_REPO=AfkaraLP/rustlean-gguf
|
| 3 |
-
# MODEL_FILE=rustlean-
|
| 4 |
# RUSTLEAN_CTX=8192
|
| 5 |
# N_GPU_LAYERS=-1
|
|
|
|
| 1 |
HF_TOKEN=hf_xxx
|
| 2 |
# MODEL_REPO=AfkaraLP/rustlean-gguf
|
| 3 |
+
# MODEL_FILE=rustlean-v4.Q8_0.gguf
|
| 4 |
# RUSTLEAN_CTX=8192
|
| 5 |
# N_GPU_LAYERS=-1
|
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: RustLean FIM Playground
|
| 3 |
emoji: 🦀
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: red
|
|
@@ -13,12 +13,14 @@ models:
|
|
| 13 |
short_description: Cursor-aware Rust FIM code completion
|
| 14 |
---
|
| 15 |
|
| 16 |
-
# RustLean FIM Playground
|
| 17 |
|
| 18 |
Cursor-aware Rust code completion using
|
| 19 |
[`AfkaraLP/rustlean-gguf`](https://huggingface.co/AfkaraLP/rustlean-gguf) — a
|
| 20 |
Qwen2.5-Coder-1.5B model fine-tuned for **fill-in-the-middle (FIM)** on Rust,
|
| 21 |
-
served via `llama-cpp-python`.
|
|
|
|
|
|
|
| 22 |
|
| 23 |
## How it works
|
| 24 |
|
|
@@ -47,7 +49,7 @@ Optional environment overrides (Space Variables or local `.env`):
|
|
| 47 |
| Variable | Default | Meaning |
|
| 48 |
| ---------------- | -------------------------- | -------------------------------------- |
|
| 49 |
| `MODEL_REPO` | `AfkaraLP/rustlean-gguf` | HF repo id |
|
| 50 |
-
| `MODEL_FILE` | `rustlean-
|
| 51 |
| `RUSTLEAN_CTX` | `8192` | Context window |
|
| 52 |
| `N_GPU_LAYERS` | `-1` | `-1` offloads all layers to the GPU |
|
| 53 |
|
|
|
|
| 1 |
---
|
| 2 |
+
title: RustLean v4 FIM Playground
|
| 3 |
emoji: 🦀
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: red
|
|
|
|
| 13 |
short_description: Cursor-aware Rust FIM code completion
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# RustLean v4 FIM Playground
|
| 17 |
|
| 18 |
Cursor-aware Rust code completion using
|
| 19 |
[`AfkaraLP/rustlean-gguf`](https://huggingface.co/AfkaraLP/rustlean-gguf) — a
|
| 20 |
Qwen2.5-Coder-1.5B model fine-tuned for **fill-in-the-middle (FIM)** on Rust,
|
| 21 |
+
served via `llama-cpp-python`. RustLean v4 improves private AST exact match
|
| 22 |
+
from the base model's 22.5% to 35.0% while matching its deterministic
|
| 23 |
+
HumanEvalPack-Rust pass rate.
|
| 24 |
|
| 25 |
## How it works
|
| 26 |
|
|
|
|
| 49 |
| Variable | Default | Meaning |
|
| 50 |
| ---------------- | -------------------------- | -------------------------------------- |
|
| 51 |
| `MODEL_REPO` | `AfkaraLP/rustlean-gguf` | HF repo id |
|
| 52 |
+
| `MODEL_FILE` | `rustlean-v4.Q8_0.gguf` | GGUF filename |
|
| 53 |
| `RUSTLEAN_CTX` | `8192` | Context window |
|
| 54 |
| `N_GPU_LAYERS` | `-1` | `-1` offloads all layers to the GPU |
|
| 55 |
|
app.py
CHANGED
|
@@ -30,7 +30,7 @@ except Exception:
|
|
| 30 |
return deco
|
| 31 |
|
| 32 |
MODEL_REPO = os.environ.get("MODEL_REPO", "AfkaraLP/rustlean-gguf")
|
| 33 |
-
MODEL_FILE = os.environ.get("MODEL_FILE", "rustlean-
|
| 34 |
CTX = int(os.environ.get("RUSTLEAN_CTX", "8192"))
|
| 35 |
N_GPU_LAYERS = int(os.environ.get("N_GPU_LAYERS", "-1"))
|
| 36 |
|
|
@@ -177,12 +177,14 @@ def complete(code, temperature, max_tokens, top_p):
|
|
| 177 |
return "", code, "```\n" + traceback.format_exc() + "\n```"
|
| 178 |
|
| 179 |
|
| 180 |
-
with gr.Blocks(title="RustLean FIM Playground") as demo:
|
| 181 |
gr.Markdown(
|
| 182 |
-
"#
|
| 183 |
"Fill-in-the-middle completion from "
|
| 184 |
"[`AfkaraLP/rustlean-gguf`](https://huggingface.co/AfkaraLP/rustlean-gguf) "
|
| 185 |
-
"(Qwen2.5-Coder-1.5B, Q8_0).
|
|
|
|
|
|
|
| 186 |
"write code. Everything before it is the prefix, everything after is the suffix."
|
| 187 |
)
|
| 188 |
|
|
|
|
| 30 |
return deco
|
| 31 |
|
| 32 |
MODEL_REPO = os.environ.get("MODEL_REPO", "AfkaraLP/rustlean-gguf")
|
| 33 |
+
MODEL_FILE = os.environ.get("MODEL_FILE", "rustlean-v4.Q8_0.gguf")
|
| 34 |
CTX = int(os.environ.get("RUSTLEAN_CTX", "8192"))
|
| 35 |
N_GPU_LAYERS = int(os.environ.get("N_GPU_LAYERS", "-1"))
|
| 36 |
|
|
|
|
| 177 |
return "", code, "```\n" + traceback.format_exc() + "\n```"
|
| 178 |
|
| 179 |
|
| 180 |
+
with gr.Blocks(title="RustLean v4 FIM Playground") as demo:
|
| 181 |
gr.Markdown(
|
| 182 |
+
"# RustLean v4: Rust FIM Completion\n"
|
| 183 |
"Fill-in-the-middle completion from "
|
| 184 |
"[`AfkaraLP/rustlean-gguf`](https://huggingface.co/AfkaraLP/rustlean-gguf) "
|
| 185 |
+
"(Qwen2.5-Coder-1.5B, Q8_0). The v4 release improves repository-disjoint "
|
| 186 |
+
"Rust completion while retaining the base model's compiler-tested pass rate. "
|
| 187 |
+
"Put **`<|cursor|>`** where you want the model to "
|
| 188 |
"write code. Everything before it is the prefix, everything after is the suffix."
|
| 189 |
)
|
| 190 |
|