Upload 3 files
Browse files- README.md +22 -8
- app.py +39 -0
- requirements.txt +3 -0
README.md
CHANGED
|
@@ -1,11 +1,25 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 7 |
---
|
| 8 |
-
This model was trained on a Claude Sonnet 4 (non-reasoning) dataset and a Claude Sonnet 3.7 (reasoning) dataset. It is a reasoning model.
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Qwen3-4B Claude Reasoning
|
| 3 |
+
emoji: 🧠
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: gradio
|
| 7 |
+
pinned: true
|
| 8 |
---
|
|
|
|
| 9 |
|
| 10 |
+
# Qwen3-4B Claude Sonnet Reasoning Distill (GGUF Q8_0)
|
| 11 |
+
|
| 12 |
+
This model was trained on a **Claude Sonnet 4 (non-reasoning)** dataset and a **Claude Sonnet 3.7 (reasoning)** dataset.
|
| 13 |
+
|
| 14 |
+
- 🧬 Datasets:
|
| 15 |
+
- `Liontix/claude-sonnet-4-100x`
|
| 16 |
+
- `reedmayhew/claude-3.7-sonnet-reasoning`
|
| 17 |
+
|
| 18 |
+
- 🏗 Base Model:
|
| 19 |
+
- `unsloth/Qwen3-4B-unsloth-bnb-4bit`
|
| 20 |
+
|
| 21 |
+
If you want to fine-tune this model:
|
| 22 |
+
- Start from: `Liontix/Qwen3-4B-Claude-Sonnet-4-Reasoning-Distill-Safetensor`
|
| 23 |
+
- Change dataset as needed in your training script or notebook
|
| 24 |
+
|
| 25 |
+
Prompt format uses Claude-style `<|im_start|>` / `<|im_end|>` markers with role tags.
|
app.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from huggingface_hub import hf_hub_download
|
| 3 |
+
from llama_cpp import Llama
|
| 4 |
+
|
| 5 |
+
REPO_ID = "mradermacher/Qwen3-4B-Claude-Sonnet-4-Reasoning-Distill-Safetensor-GGUF"
|
| 6 |
+
MODEL_FILENAME = "qwen3-4b-claude-sonnet-4-reasoning-distill.Q8_0.gguf"
|
| 7 |
+
|
| 8 |
+
model_path = hf_hub_download(
|
| 9 |
+
repo_id=REPO_ID,
|
| 10 |
+
filename=MODEL_FILENAME,
|
| 11 |
+
local_dir="/home/user/app/models"
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
llm = Llama(
|
| 15 |
+
model_path=model_path,
|
| 16 |
+
n_ctx=4096,
|
| 17 |
+
n_threads=4,
|
| 18 |
+
temperature=0.4,
|
| 19 |
+
repeat_penalty=1.1,
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# Claude-style system/user/assistant formatted prompt
|
| 23 |
+
def generate_response(user_input):
|
| 24 |
+
prompt = (
|
| 25 |
+
"<|im_start|>system\nYou are a helpful assistant.\n<|im_end|>\n"
|
| 26 |
+
f"<|im_start|>user\n{user_input}<|im_end|>\n"
|
| 27 |
+
"<|im_start|>assistant\n"
|
| 28 |
+
).format(user_input=user_input)
|
| 29 |
+
|
| 30 |
+
output = llm(prompt, max_tokens=512, stop=["<|im_end|>"])
|
| 31 |
+
return output["choices"][0]["text"]
|
| 32 |
+
|
| 33 |
+
gr.Interface(
|
| 34 |
+
fn=generate_response,
|
| 35 |
+
inputs=gr.Textbox(label="Prompt", lines=4),
|
| 36 |
+
outputs=gr.Textbox(label="Claude-Sonnet Response"),
|
| 37 |
+
title="Claude Reasoning Chat - Qwen3-4B",
|
| 38 |
+
description="Uses Claude-style system/user/assistant prompting with Qwen3-4B Reasoning Distill model."
|
| 39 |
+
).launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
huggingface_hub
|
| 3 |
+
llama-cpp-python==0.2.68
|