初始化项目,由ModelHub XC社区提供模型

Model: uaytug/ucoder-mini-GGUF
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-06-17 12:41:18 +08:00
commit 0cf144809f
18 changed files with 481 additions and 0 deletions

50
.gitattributes vendored Normal file
View File

@@ -0,0 +1,50 @@
*.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
ucoder-mini-f16.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-IQ2_M.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-IQ3_XXS.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-IQ4_NL.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q4_1.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
uCoder-mini-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text

326
README.md Normal file
View File

@@ -0,0 +1,326 @@
---
license: apache-2.0
datasets:
- uaytug/UCDS
language:
- en
tags:
- code
- programming
- mathematics
- reasoning
- text-generation
- conversational
- qwen2
pipeline_tag: text-generation
library_name: transformers
base_model:
- uaytug/ucoder-mini
---
# uCoder-mini-GGUF
Quantized GGUF models converted from [uaytug/ucoder-mini](https://huggingface.co/uaytug/ucoder-mini).
Converted using the latest llama.cpp (CUDA-accelerated quantization).
### Available Files
**16-bit**
- `ucoder-mini-BF16.gguf`**Highest precision float (similar to original, ~3 GB)**
**8-bit**
- `ucoder-mini-Q8_0.gguf`**Near-lossless**
**6-bit**
- `ucoder-mini-Q6_K.gguf`
**5-bit**
- `ucoder-mini-Q5_K_S.gguf`
- `ucoder-mini-Q5_K_M.gguf`**Great quality**
**4-bit** (most popular range)
- `ucoder-mini-Q4_K_M.gguf`**Recommended balance**
- `ucoder-mini-Q4_K_S.gguf`
- `ucoder-mini-Q4_1.gguf`
- `ucoder-mini-IQ4_XS.gguf`
- `ucoder-mini-IQ4_NL.gguf`
**3-bit**
- `ucoder-mini-Q3_K_S.gguf`
- `ucoder-mini-Q3_K_M.gguf`
- `ucoder-mini-IQ3_XXS.gguf`
**2-bit**
- `ucoder-mini-Q2_K.gguf`
- `ucoder-mini-IQ2_M.gguf`
## Original Model Information
# uCoder Mini
> **Important:** The model is unable to produce accurate and high-quality answers to general knowledge, creative writing, or non-coding tasks, and to questions asked in languages other than English. The answers to your questions in these areas may not be satisfactory because this model was specifically trained for **coding and mathematical reasoning tasks** (competitive programming, LeetCode, algorithm problems, etc.).
![Parameters](https://img.shields.io/badge/Parameters-1.5B-blue) ![Architecture](https://img.shields.io/badge/Architecture-Qwen2-purple) ![Context](https://img.shields.io/badge/Context-4096-green) ![Precision](https://img.shields.io/badge/Precision-bfloat16-red) ![License](https://img.shields.io/badge/License-Apache%202.0-orange)
## Overview
**uCoder Mini** is a 1.5B parameter dense language model fine-tuned specifically for code generation and mathematical reasoning. Built on the Qwen2 architecture, this model demonstrates that small, focused models can achieve strong performance on programming tasks when trained on high-quality, curated data.
### Key Features
- **Specialized Focus**: Trained exclusively on coding and math data for maximum performance in these domains
- **Efficient Size**: 1.5B parameters — runs on consumer GPUs, fast inference
- **Extended Context**: Supports up to 4096 tokens for longer code generation
- **Multi-Language**: Handles Python, JavaScript, C++, Java, and more
- **Competitive Programming**: Strong on algorithmic problems (LeetCode, Codeforces-style)
## Model Details
| Attribute | Value |
|-----------|-------|
| **Architecture** | Qwen2 (Dense Transformer) |
| **Parameters** | ~1.5B |
| **Hidden Size** | 1536 |
| **Layers** | 28 |
| **Attention Heads** | 12 |
| **Context Length** | 4096 tokens |
| **Vocabulary Size** | 151,936 |
| **Training Precision** | bfloat16 |
| **Training Method** | Supervised Fine-Tuning (SFT) |
## Intended Use
**Recommended for:**
- Competitive programming (LeetCode, Codeforces, HackerRank)
- Algorithm implementation and optimization
- Mathematical problem solving with code
- Code debugging and explanation
- Learning programming concepts
**Not recommended for:**
- General conversation or chat
- Creative writing or storytelling
- Factual Q&A or knowledge retrieval
- Non-English tasks
- Production systems without human review
## Quick Start
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "uaytug/ucoder-mini"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto"
)
messages = [
{"role": "user", "content": "Write a Python function to find the longest palindromic substring."}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=1024,
temperature=0.6,
top_p=0.95,
do_sample=True
)
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(response)
```
### Recommended Generation Parameters
For best results on coding tasks:
```python
generation_config = {
"max_new_tokens": 2048,
"temperature": 0.6, # Use 0.6 for focused output, 1.0 for more exploration
"top_p": 0.95,
"do_sample": True,
}
```
## Chat Template
uCoder Mini uses the ChatML format:
```
<|im_start|>user
Your coding question here<|im_end|>
<|im_start|>assistant
```
## Training Data
Trained on [UCDS (uCoder Dataset)](https://huggingface.co/datasets/uaytug/UCDS) — a curated collection of 420K+ high-quality samples:
| Source | Samples | Description |
|--------|---------|-------------|
| Codeforces | 47K+ | Competitive programming with solutions |
| Code-Contests-Plus | 10K+ | Algorithm challenges |
| CodeAlpaca | 15K+ | Instruction-following code |
| OpenMathInstruct | Various | Mathematical reasoning chains |
| Curated Sources | Various | Tool use, chain-of-thought, deduplication |
**Total**: 420,686 deduplicated samples covering Python, JavaScript, C++, Java, and more.
## Limitations
- **Domain-Specific**: This model is trained only on code/math — it will perform poorly on general tasks
- **English Only**: Best performance in English; other languages not supported
- **Knowledge Cutoff**: May not know about recent libraries, frameworks, or API changes
- **No Verification**: Always test generated code before use in production
- **Context Limit**: 4096 tokens may not be enough for very large codebases
- **No Web Access**: Cannot fetch documentation or search for solutions
## Example Outputs
<details>
<summary><b>Algorithm Problem</b></summary>
**Prompt:** Implement a function to find the kth largest element in an unsorted array.
```python
import heapq
def find_kth_largest(nums, k):
# Use a min-heap of size k
# Time: O(n log k), Space: O(k)
heap = []
for num in nums:
heapq.heappush(heap, num)
if len(heap) > k:
heapq.heappop(heap)
return heap[0]
# Alternative: QuickSelect for O(n) average
def quickselect(nums, k):
k = len(nums) - k # Convert to kth smallest
def partition(left, right, pivot_idx):
pivot = nums[pivot_idx]
nums[pivot_idx], nums[right] = nums[right], nums[pivot_idx]
store_idx = left
for i in range(left, right):
if nums[i] < pivot:
nums[store_idx], nums[i] = nums[i], nums[store_idx]
store_idx += 1
nums[right], nums[store_idx] = nums[store_idx], nums[right]
return store_idx
left, right = 0, len(nums) - 1
while True:
pivot_idx = partition(left, right, right)
if pivot_idx == k:
return nums[k]
elif pivot_idx < k:
left = pivot_idx + 1
else:
right = pivot_idx - 1
```
</details>
<details>
<summary><b>Mathematical Reasoning</b></summary>
**Prompt:** Prove that the sum of the first n odd numbers equals n².
**Response:**
Let's prove this by multiple methods:
**Method 1: Direct Calculation**
The first n odd numbers are: 1, 3, 5, ..., (2n-1)
Sum = 1 + 3 + 5 + ... + (2n-1)
This is an arithmetic sequence with:
- First term a₁ = 1
- Last term aₙ = 2n - 1
- Number of terms = n
Sum = n × (first + last) / 2 = n × (1 + 2n - 1) / 2 = n × 2n / 2 = n²
**Method 2: Induction**
- Base case: n=1 → Sum = 1 = 1² ✓
- Assume true for k: 1 + 3 + ... + (2k-1) = k²
- For k+1: k² + (2(k+1)-1) = k² + 2k + 1 = (k+1)² ✓
</details>
<details>
<summary><b>Debugging</b></summary>
**Prompt:** Why does this code give wrong results?
```python
def binary_search(arr, target):
left, right = 0, len(arr)
while left < right:
mid = (left + right) / 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
left = mid
else:
right = mid
return -1
```
**Response:** There are several bugs:
1. **Integer division**: `mid = (left + right) / 2` returns a float. Use `//` for integer division.
2. **Infinite loop**: `left = mid` can cause infinite loop when `mid == left`. Should be `left = mid + 1`.
3. **Off-by-one**: With `right = len(arr)`, using `right = mid` is correct, but the initial range setup suggests you want `right = len(arr) - 1` with `left <= right`.
**Fixed version:**
```python
def binary_search(arr, target):
left, right = 0, len(arr) - 1
while left <= right:
mid = (left + right) // 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
left = mid + 1
else:
right = mid - 1
return -1
```
</details>
## Hardware Requirements
| Setup | VRAM Required | Notes |
|-------|---------------|-------|
| FP16/BF16 | ~3 GB | Full precision inference |
## Citation
```bibtex
@misc{ucoder-mini,
author = {uaytug},
title = {uCoder Mini: A Compact Language Model for Code and Math},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/uaytug/ucoder-mini}
}
```
## Acknowledgments
Thanks to the open-source community and creators of the datasets that made UCDS possible.

60
config.json Normal file
View File

@@ -0,0 +1,60 @@
{
"_attn_implementation_autoset": true,
"architectures": [
"Qwen2ForCausalLM"
],
"attention_dropout": 0.0,
"dtype": "float16",
"eos_token_id": 151643,
"hidden_act": "silu",
"hidden_size": 1536,
"initializer_range": 0.02,
"intermediate_size": 8960,
"layer_types": [
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention"
],
"max_position_embeddings": 131072,
"max_window_layers": 21,
"model_type": "qwen2",
"num_attention_heads": 12,
"num_hidden_layers": 28,
"num_key_value_heads": 2,
"pad_token_id": 151643,
"rms_norm_eps": 1e-06,
"rope_scaling": null,
"rope_theta": 640000,
"sliding_window": null,
"tie_word_embeddings": true,
"transformers_version": "4.57.3",
"use_cache": false,
"use_mrope": false,
"use_sliding_window": false,
"vocab_size": 151936
}

3
uCoder-mini-IQ2_M.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c606b4204621ba864551cfdaccfeedab86e40892411491b04ec414271a23b61
size 166402368

3
uCoder-mini-IQ3_XXS.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c606b4204621ba864551cfdaccfeedab86e40892411491b04ec414271a23b61
size 166402368

3
uCoder-mini-IQ4_NL.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c608c660a5356035c66d8a917e56a14e9e8d111074eeed97176ac91d6e6a39bb
size 941492032

3
uCoder-mini-IQ4_XS.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f6c44edb7f8d570d01e4b3c3706cf587ed9388d021b18db7b16adb8f351ad0a4
size 902182720

3
uCoder-mini-Q2_K.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:62b2689e255e1bd76eb9e5cc9bc667038ae02770e7f55867f085a426867fc549
size 676304704

3
uCoder-mini-Q3_K_M.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dc7386c4eaf2bd06fde0a4e18b7c459e8f04b234f2f32b9c279a8af9f5645c92
size 824178496

3
uCoder-mini-Q3_K_S.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:99593e7891fc52b2fdfbb5863b3c8031887c641dc390410eb7a18be4bfc3d4d1
size 760944448

3
uCoder-mini-Q4_1.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c327d1d4f638caa902e8921dc75b4fe5f4a99dcbf42332ab13d0fe504785a0ce
size 1016842048

3
uCoder-mini-Q4_K_M.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ff5a62f35b19c63ea0b821d74a6452b97d92efd709dfbfc4cdc9d98710493c42
size 986048320

3
uCoder-mini-Q4_K_S.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:add6fbcda69680b99e257ccc3a2af07f745a656e8a61b98041c69dcb8fa0b315
size 940312384

3
uCoder-mini-Q5_K_M.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:780237cda0519740230a1e3113a0cecf677b6dc921524231655d317595e7e5dc
size 1125050176

3
uCoder-mini-Q5_K_S.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3090412e5e422cbcc0380f76da1a6667512f196ddfcebc18197cb4ca95b13d0
size 1098729280

3
uCoder-mini-Q6_K.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:56dbcd28c6e09a143f9bb90327950703669729d20a140e0f3819d34879f9e996
size 1272739648

3
uCoder-mini-Q8_0.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7f955577b6206d4b99c263ae268fe665ae5c990787a3e47ddf8ebbdd706ad0e9
size 1646572864

3
ucoder-mini-f16.gguf Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f70a75cc708725ae779220721e5753b662bb4961db033b9e3d5ecc6b0321dcd
size 3093668736