Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
| 4 |
+
tags:
|
| 5 |
+
- triton
|
| 6 |
+
- kernel
|
| 7 |
+
- code-generation
|
| 8 |
+
- fine-tuned
|
| 9 |
+
datasets:
|
| 10 |
+
- triton-kernels-6k
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Triton Kernel Code Generation Model
|
| 17 |
+
|
| 18 |
+
This model is a fine-tuned version of Qwen/Qwen2.5-1.5B-Instruct specialized for generating Triton GPU kernels.
|
| 19 |
+
|
| 20 |
+
## Model Details
|
| 21 |
+
|
| 22 |
+
- **Base Model**: Qwen/Qwen2.5-1.5B-Instruct
|
| 23 |
+
- **Fine-tuned on**: 6000 examples of Triton kernel code
|
| 24 |
+
- **Training Loss**: 0.20
|
| 25 |
+
- **Eval Perplexity**: 1.22
|
| 26 |
+
|
| 27 |
+
## Usage
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 31 |
+
|
| 32 |
+
model = AutoModelForCausalLM.from_pretrained("cdreetz/kwen2.5-1.5b")
|
| 33 |
+
tokenizer = AutoTokenizer.from_pretrained("cdreetz/kwen2.5-1.5b")
|
| 34 |
+
|
| 35 |
+
prompt = "Write a Triton kernel for element-wise addition:"
|
| 36 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 37 |
+
outputs = model.generate(**inputs, max_new_tokens=512)
|
| 38 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 39 |
+
print(response)
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## Training Details
|
| 43 |
+
|
| 44 |
+
- **Epochs**: 2
|
| 45 |
+
- **Batch Size**: 2
|
| 46 |
+
- **Learning Rate**: 1e-5
|
| 47 |
+
- **Dataset Size**: 6000 examples
|
| 48 |
+
|
| 49 |
+
## Performance
|
| 50 |
+
|
| 51 |
+
The model generates syntactically correct Triton kernels with proper:
|
| 52 |
+
- `@triton.jit` decorators
|
| 53 |
+
- Kernel function signatures
|
| 54 |
+
- Launch function implementations
|
| 55 |
+
- Memory access patterns
|
| 56 |
+
- Grid configurations
|
| 57 |
+
|
| 58 |
+
## Limitations
|
| 59 |
+
|
| 60 |
+
- Specialized for Triton kernel generation only
|
| 61 |
+
- May require prompt engineering for optimal results
|
| 62 |
+
- Generated kernels should be tested before production use
|