Add PyTorch model files
Browse files
README.md
CHANGED
@@ -1,100 +1,58 @@
|
|
1 |
---
|
2 |
-
tags:
|
3 |
-
- pytorch
|
4 |
-
- safetensors
|
5 |
-
- transformers
|
6 |
-
- gpt-oss
|
7 |
-
- multilingual
|
8 |
-
- text-generation
|
9 |
-
language:
|
10 |
-
- en
|
11 |
-
- es
|
12 |
-
- fr
|
13 |
-
- de
|
14 |
-
- it
|
15 |
-
- pt
|
16 |
-
license: apache-2.0
|
17 |
-
model_type: gpt-oss
|
18 |
-
pipeline_tag: text-generation
|
19 |
base_model: openai/gpt-oss-20b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
---
|
21 |
|
22 |
-
#
|
23 |
-
|
24 |
-
This repository contains the GPT-OSS-20B model fine-tuned on function calling data in PyTorch/Safetensors format, ready for use with the Transformers library.
|
25 |
-
|
26 |
-
## Model Details
|
27 |
-
|
28 |
-
- **Base Model:** openai/gpt-oss-20b
|
29 |
-
- **Fine-tuning Dataset:** Salesforce/xlam-function-calling-60k (2000 samples)
|
30 |
-
- **Fine-tuning Method:** LoRA (r=8, alpha=16)
|
31 |
-
- **Context Length:** 131,072 tokens
|
32 |
-
- **Model Size:** 20B parameters
|
33 |
-
|
34 |
-
## Files
|
35 |
-
|
36 |
-
- `model.safetensors`: Model weights in Safetensors format
|
37 |
-
- `config.json`: Model configuration
|
38 |
-
- `tokenizer.json`, `tokenizer_config.json`: Tokenizer files
|
39 |
-
- `generation_config.json`: Generation configuration
|
40 |
|
41 |
-
|
|
|
42 |
|
43 |
-
|
44 |
|
45 |
```python
|
46 |
-
from transformers import
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
device_map="auto"
|
53 |
-
)
|
54 |
-
tokenizer = AutoTokenizer.from_pretrained("cuijian0819/gpt-oss-20b-function-calling")
|
55 |
-
|
56 |
-
# Generate text
|
57 |
-
inputs = tokenizer("Your prompt here", return_tensors="pt")
|
58 |
-
outputs = model.generate(**inputs, max_length=100, temperature=0.7)
|
59 |
-
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
60 |
```
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
This model can be further fine-tuned using standard PyTorch/Transformers workflows:
|
65 |
|
66 |
-
|
67 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer, Trainer, TrainingArguments
|
68 |
|
69 |
-
model = AutoModelForCausalLM.from_pretrained("cuijian0819/gpt-oss-20b-function-calling")
|
70 |
-
tokenizer = AutoTokenizer.from_pretrained("cuijian0819/gpt-oss-20b-function-calling")
|
71 |
|
72 |
-
|
73 |
-
```
|
74 |
|
75 |
-
|
76 |
|
77 |
-
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
##
|
80 |
|
81 |
-
- **Training Epochs:** 2
|
82 |
-
- **Learning Rate:** 0.0002
|
83 |
-
- **Batch Size:** 4
|
84 |
-
- **Gradient Accumulation:** 4
|
85 |
-
- **Max Length:** 1024
|
86 |
|
87 |
-
## License
|
88 |
-
|
89 |
-
This model inherits the license from the base openai/gpt-oss-20b model.
|
90 |
-
|
91 |
-
## Citation
|
92 |
|
|
|
|
|
93 |
```bibtex
|
94 |
-
@misc{
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
99 |
}
|
100 |
-
```
|
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
base_model: openai/gpt-oss-20b
|
3 |
+
library_name: transformers
|
4 |
+
model_name: fine_tuned
|
5 |
+
tags:
|
6 |
+
- generated_from_trainer
|
7 |
+
- trl
|
8 |
+
- sft
|
9 |
+
licence: license
|
10 |
---
|
11 |
|
12 |
+
# Model Card for fine_tuned
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
This model is a fine-tuned version of [openai/gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b).
|
15 |
+
It has been trained using [TRL](https://github.com/huggingface/trl).
|
16 |
|
17 |
+
## Quick start
|
18 |
|
19 |
```python
|
20 |
+
from transformers import pipeline
|
21 |
|
22 |
+
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
|
23 |
+
generator = pipeline("text-generation", model="cuijian0819/fine_tuned", device="cuda")
|
24 |
+
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
|
25 |
+
print(output["generated_text"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
```
|
27 |
|
28 |
+
## Training procedure
|
|
|
|
|
29 |
|
30 |
+
|
|
|
31 |
|
|
|
|
|
32 |
|
33 |
+
This model was trained with SFT.
|
|
|
34 |
|
35 |
+
### Framework versions
|
36 |
|
37 |
+
- TRL: 0.21.0
|
38 |
+
- Transformers: 4.55.0
|
39 |
+
- Pytorch: 2.7.1+cu118
|
40 |
+
- Datasets: 4.0.0
|
41 |
+
- Tokenizers: 0.21.4
|
42 |
|
43 |
+
## Citations
|
44 |
|
|
|
|
|
|
|
|
|
|
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
+
Cite TRL as:
|
48 |
+
|
49 |
```bibtex
|
50 |
+
@misc{vonwerra2022trl,
|
51 |
+
title = {{TRL: Transformer Reinforcement Learning}},
|
52 |
+
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
|
53 |
+
year = 2020,
|
54 |
+
journal = {GitHub repository},
|
55 |
+
publisher = {GitHub},
|
56 |
+
howpublished = {\url{https://github.com/huggingface/trl}}
|
57 |
}
|
58 |
+
```
|