File size: 1,562 Bytes
930266b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
base_model: openai/gpt-oss-20b
library_name: transformers
tags:
- lora
- sft
- tool-use
- gpt-oss
license: apache-2.0
---

# gpt-oss-claude-code

Fine-tuned [`openai/gpt-oss-20b`](https://huggingface.co/openai/gpt-oss-20b) for tool-use and agentic coding tasks. LoRA adapters merged into base weights.

## Quick start
```python
import re, torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "deburky/gpt-oss-claude-code",
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained("deburky/gpt-oss-claude-code")

messages = [{"role": "user", "content": "Who is Alan Turing?"}]
inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True,
    return_tensors="pt", return_dict=True,
).to(model.device)

with torch.no_grad():
    out = model.generate(**inputs, max_new_tokens=256)
response = tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:])

if "<|channel|>final<|message|>" in response:
    response = response.split("<|channel|>final<|message|>")[-1]
print(re.sub(r"<\\|[^>]+\\|>", "", response).strip())
```

## Apple Silicon (MLX)

A fused MLX version is available at [`deburky/gpt-oss-claude-mlx`](https://huggingface.co/deburky/gpt-oss-claude-mlx).

## Training

- **Data:** ~280 tool-use conversation examples in gpt-oss harmony format
- **Method:** LoRA (rank 8, alpha 16) on attention + MoE expert layers, merged after training
- **LR:** 1e-4, cosine schedule
- **Final val loss:** ~0.48
- **Hardware:** Google Colab