|
--- |
|
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) |