初始化项目,由ModelHub XC社区提供模型
Model: Ellbendls/Qwen-3-4b-Text_to_SQL-GGUF Source: Original Platform
This commit is contained in:
43
.gitattributes
vendored
Normal file
43
.gitattributes
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
Qwen-3-4b-Text_to_SQL-F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
Qwen-3-4b-Text_to_SQL-q2_k.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
Qwen-3-4b-Text_to_SQL-q3_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
Qwen-3-4b-Text_to_SQL-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
Qwen-3-4b-Text_to_SQL-q5_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
Qwen-3-4b-Text_to_SQL-q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
Qwen-3-4b-Text_to_SQL-q4_k_s.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
Qwen-3-4b-Text_to_SQL-q6_k.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
3
Qwen-3-4b-Text_to_SQL-F16.gguf
Normal file
3
Qwen-3-4b-Text_to_SQL-F16.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d11fb317207d56cbca4821d98ef536598a20b70e1ad6bafda8b5a319ae632bd1
|
||||||
|
size 8049908416
|
||||||
3
Qwen-3-4b-Text_to_SQL-q2_k.gguf
Normal file
3
Qwen-3-4b-Text_to_SQL-q2_k.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:cf3bb1c7359e462e8833b3d66dfa7e01c813d43aed0e045ee905061979f2df84
|
||||||
|
size 1668929184
|
||||||
3
Qwen-3-4b-Text_to_SQL-q3_k_m.gguf
Normal file
3
Qwen-3-4b-Text_to_SQL-q3_k_m.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:31ae258111d7f09a8294c253d5e72a9262487ce13810c9d9aabc5ffb5f0368e0
|
||||||
|
size 2075047584
|
||||||
3
Qwen-3-4b-Text_to_SQL-q4_k_m.gguf
Normal file
3
Qwen-3-4b-Text_to_SQL-q4_k_m.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2cba02402f2615ad0819b93ddc2ffcbc2699730cff79f2f6fd8591d20abe34e9
|
||||||
|
size 2496710304
|
||||||
3
Qwen-3-4b-Text_to_SQL-q4_k_s.gguf
Normal file
3
Qwen-3-4b-Text_to_SQL-q4_k_s.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8a1ad044b8d87cb9ddd30fb6c336ef599d47b24b7289c363f394d2f68b777f09
|
||||||
|
size 2382739104
|
||||||
3
Qwen-3-4b-Text_to_SQL-q5_k_m.gguf
Normal file
3
Qwen-3-4b-Text_to_SQL-q5_k_m.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3d02909d0622f86d48b961f1dc09a18d3a530773845bc7090905fa6f26fb2684
|
||||||
|
size 2888943264
|
||||||
3
Qwen-3-4b-Text_to_SQL-q6_k.gguf
Normal file
3
Qwen-3-4b-Text_to_SQL-q6_k.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d7b057d6a3415d48231a9dd64c3efcf808275818a0b85dd8870636b92a9200ae
|
||||||
|
size 3305690784
|
||||||
3
Qwen-3-4b-Text_to_SQL-q8_0.gguf
Normal file
3
Qwen-3-4b-Text_to_SQL-q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:e46c7357a73856fda807b9f0d677f14783e5f2f0d317410cd40a2502709911b0
|
||||||
|
size 4279669216
|
||||||
148
README.md
Normal file
148
README.md
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
library_name: gguf
|
||||||
|
license: apache-2.0
|
||||||
|
base_model:
|
||||||
|
- Ellbendls/Qwen-3-4b-Text_to_SQL
|
||||||
|
- Qwen/Qwen3-4B-Instruct-2507
|
||||||
|
tags:
|
||||||
|
- gguf
|
||||||
|
- llama.cpp
|
||||||
|
- qwen
|
||||||
|
- text-to-sql
|
||||||
|
- sql
|
||||||
|
- instruct
|
||||||
|
language:
|
||||||
|
- eng
|
||||||
|
- zho
|
||||||
|
- fra
|
||||||
|
- spa
|
||||||
|
- por
|
||||||
|
- deu
|
||||||
|
- ita
|
||||||
|
- rus
|
||||||
|
- jpn
|
||||||
|
- kor
|
||||||
|
- vie
|
||||||
|
- tha
|
||||||
|
- ara
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
---
|
||||||
|
|
||||||
|
# Ellbendls/Qwen-3-4b-Text_to_SQL-GGUF
|
||||||
|
|
||||||
|
Quantized GGUF builds of `Ellbendls/Qwen-3-4b-Text_to_SQL` for fast CPU/GPU inference with llama.cpp-compatible runtimes.
|
||||||
|
|
||||||
|
- **Base model**. Fine-tuned from **Qwen/Qwen3-4B-Instruct-2507** for Text-to-SQL.
|
||||||
|
- **License**. Apache-2.0 (inherits from base). Keep attribution.
|
||||||
|
- **Purpose**. Turn natural language into SQL. When schema is missing, the model can infer a simple schema then produce SQL.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
Base and quantized variants:
|
||||||
|
|
||||||
|
- `Qwen-3-4b-Text_to_SQL-F16.gguf` — reference float16 export
|
||||||
|
- `Qwen-3-4b-Text_to_SQL-q2_k.gguf`
|
||||||
|
- `Qwen-3-4b-Text_to_SQL-q3_k_m.gguf`
|
||||||
|
- `Qwen-3-4b-Text_to_SQL-q4_k_s.gguf`
|
||||||
|
- `Qwen-3-4b-Text_to_SQL-q4_k_m.gguf` ← good default
|
||||||
|
- `Qwen-3-4b-Text_to_SQL-q5_k_m.gguf`
|
||||||
|
- `Qwen-3-4b-Text_to_SQL-q6_k.gguf`
|
||||||
|
- `Qwen-3-4b-Text_to_SQL-q8_0.gguf` ← near-lossless, larger
|
||||||
|
|
||||||
|
Conversion and quantization done with `llama.cpp`.
|
||||||
|
|
||||||
|
## Recommended pick
|
||||||
|
|
||||||
|
- **Q4_K_M**. Best balance of speed and quality for laptops and small servers.
|
||||||
|
- **Q5_K_M**. Higher quality, a bit more RAM/VRAM.
|
||||||
|
- **Q8_0**. Highest quality among quants. Use if you have headroom.
|
||||||
|
|
||||||
|
## Approximate memory needs
|
||||||
|
|
||||||
|
These are ballpark for a 4B model. Real usage varies by runtime and context length.
|
||||||
|
|
||||||
|
- Q4_K_M: 3–4 GB RAM/VRAM
|
||||||
|
- Q5_K_M: 4–5 GB
|
||||||
|
- Q8_0: 6–8 GB
|
||||||
|
- F16: 10–12 GB
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
|
||||||
|
### llama.cpp (CLI)
|
||||||
|
|
||||||
|
CPU only:
|
||||||
|
```bash
|
||||||
|
./llama-cli -m Qwen-3-4b-Text_to_SQL-q4_k_m.gguf \
|
||||||
|
-p "Generate SQL to get average salary by department in 2024." \
|
||||||
|
-n 256 -t 6
|
||||||
|
````
|
||||||
|
|
||||||
|
NVIDIA GPU offload (build with `-DLLAMA_CUBLAS=ON`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./llama-cli -m Qwen-3-4b-Text_to_SQL-q4_k_m.gguf \
|
||||||
|
-p "Generate SQL to get average salary by department in 2024." \
|
||||||
|
-n 256 -ngl 999 -t 6
|
||||||
|
```
|
||||||
|
|
||||||
|
### Python (llama-cpp-python)
|
||||||
|
|
||||||
|
```python
|
||||||
|
from llama_cpp import Llama
|
||||||
|
|
||||||
|
llm = Llama(model_path="Qwen-3-4b-Text_to_SQL-q4_k_m.gguf", n_ctx=4096, n_gpu_layers=35) # set 0 for CPU-only
|
||||||
|
prompt = "Generate SQL to list total orders and revenue by month for 2024."
|
||||||
|
out = llm(prompt, max_tokens=256, temperature=0.2, top_p=0.9)
|
||||||
|
print(out["choices"][0]["text"].strip())
|
||||||
|
```
|
||||||
|
|
||||||
|
### LM Studio / Kobold / text-generation-webui
|
||||||
|
|
||||||
|
* Select the `.gguf` file and load.
|
||||||
|
* Set temperature 0.1–0.3 for deterministic SQL.
|
||||||
|
* Use a system prompt to anchor behavior.
|
||||||
|
|
||||||
|
## Model details
|
||||||
|
|
||||||
|
* **Base**. `Qwen/Qwen3-4B-Instruct-2507` (32k context, multilingual).
|
||||||
|
* **Fine-tune**. Trained on `gretelai/synthetic_text_to_sql`.
|
||||||
|
* **Task**. NL → SQL. Capable of simple schema inference when needed.
|
||||||
|
* **Languages**. Works best in English. Can follow prompts in several languages from the base model.
|
||||||
|
|
||||||
|
## Conversion reproducibility
|
||||||
|
|
||||||
|
Export used:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python convert_hf_to_gguf.py /path/to/hf_model --outtype f16 --outfile Qwen-3-4b-Text_to_SQL-F16.gguf
|
||||||
|
```
|
||||||
|
|
||||||
|
Quantization used:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./llama-quantize Qwen-3-4b-Text_to_SQL-F16.gguf Qwen-3-4b-Text_to_SQL-q4_k_m.gguf Q4_K_M
|
||||||
|
# likewise for q2_k, q3_k_m, q5_k_m, q8_0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Intended use and limits
|
||||||
|
|
||||||
|
* **Use**. Analytics, reporting, dashboards, data exploration, SQL prototyping.
|
||||||
|
* **Limits**. No database connectivity. It only generates SQL text. Validate and test queries before use in production. Provide real schema for best accuracy.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
* Base model: [`Qwen/Qwen3-4B-Instruct-2507`](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507)
|
||||||
|
* Fine-tuned model: [`Ellbendls/Qwen-3-4b-Text_to_SQL`](https://huggingface.co/Ellbendls/Qwen-3-4b-Text_to_SQL)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Apache-2.0. Include license and NOTICE from upstream when redistributing the weights. Do not imply endorsement from Qwen or original authors.
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
* 2025-09-17. Initial GGUF release. Added q2\_k, q3\_k\_m, q4\_k\_m, q5\_k\_m, q8\_0, and F16.
|
||||||
|
|
||||||
|
```
|
||||||
|
::contentReference[oaicite:0]{index=0}
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user