File size: 2,931 Bytes
27c3c03 ac5953d 27c3c03 ac5953d 27c3c03 ac5953d 27c3c03 ac5953d 27c3c03 ac5953d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
---
base_model: unsloth/gpt-oss-20b-unsloth-bnb-4bit
tags:
- text-generation-inference
- transformers
- unsloth
- gpt_oss
license: apache-2.0
language:
- en
datasets:
- microsoft/rStar-Coder
---
# GPT-OSS-Coder-20B
<img src="banner.png" width="800" />
This model is a fine-tuned version of OpenAI's **GPT-OSS-20B**, optimized for code generation tasks. The fine-tuning leveraged the **Unsloth** library to enable efficient low-bit quantized training and inference.
## Model Details
* **Base Model:** [openai/gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b)
* **Training Framework:** Hugging Face's TRL library combined with [Unsloth](https://github.com/Unsloth-org/Unsloth) optimizations.
* **Training Data:** 1 million randomly generated records, trained for 150 steps
## Intended Use
This model is designed to assist with:
* Code generation and completion
* Programming query answering
* Code summarization
## About `reasoning_effort`
The `reasoning_effort` parameter influences the model's focus during text generation:
* **`low`**: Produces straightforward, concise answers suitable for simple coding tasks.
* **`medium`**: Balances speed and detail, suitable for moderate complexity tasks.
* **`high`**: Encourages detailed and complex reasoning, useful for advanced code generation or explanations.
Adjusting this parameter allows you to control the depth of the model's reasoning process, balancing between performance and response complexity.
## Usage Example
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers import TextStreamer
tokenizer = AutoTokenizer.from_pretrained("yasserrmd/gpt-oss-coder-20b")
model = AutoModelForCausalLM.from_pretrained("yasserrmd/gpt-oss-coder-20b")
messages = [
{"role": "system", "content": "You are a helpful coding assistant."},
{"role": "user", "content": "Using Python to connect MySQL and retrieve table 'employee' where empno is 1234."},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
reasoning_effort="low",
).to(model.device)
streamer = TextStreamer(tokenizer)
_ = model.generate(**inputs, max_new_tokens=512, streamer=streamer)
```
## Training Overview
The fine-tuning process adapted GPT-OSS-20B to better assist with coding tasks by fine-tuning on a dataset of 1 million random records. The training utilized **only the Unsloth** library for efficient low-bit quantized fine-tuning.
## Citation
```bibtex
@misc{yasserrmd2025gptosscoder20b,
author = {Yasser RMD},
title = {GPT-OSS-Coder-20B},
year = {2025},
publisher = {Hugging Face},
journal = {Hugging Face Model Hub},
url = {https://huggingface.co/yasserrmd/gpt-oss-coder-20b}
}
```
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth) |