oki0ki silverfisk commited on
Commit
d7f370a
·
0 Parent(s):

Duplicate from silverfisk/gpt-oss-20b-practice

Browse files

Co-authored-by: Tom <silverfisk@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ gpt-oss-20b.MXFP4.gguf filter=lfs diff=lfs merge=lfs -text
Modelfile ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ FROM gpt-oss-20b.MXFP4.gguf
3
+ TEMPLATE """<|start|>system<|message|>You are ChatGPT, a large language model trained by OpenAI.
4
+ Knowledge cutoff: 2024-06
5
+ Current date: {{ currentDate }}
6
+ {{- if and .IsThinkSet .Think (ne .ThinkLevel "") }}
7
+
8
+ Reasoning: {{ .ThinkLevel }}
9
+ {{- else if or (not .IsThinkSet) (and .IsThinkSet .Think) }}
10
+
11
+ Reasoning: medium
12
+ {{- end }}
13
+
14
+ {{- $hasNonBuiltinTools := false }}
15
+ {{- if .Tools -}}
16
+ {{- $hasBrowserSearch := false }}
17
+ {{- $hasBrowserOpen := false }}
18
+ {{- $hasBrowserFind := false }}
19
+ {{- $hasPython := false }}
20
+ {{- range .Tools }}
21
+ {{- if eq .Function.Name "browser.search" -}}{{- $hasBrowserSearch = true -}}
22
+ {{- else if eq .Function.Name "browser.open" -}}{{- $hasBrowserOpen = true -}}
23
+ {{- else if eq .Function.Name "browser.find" -}}{{- $hasBrowserFind = true -}}
24
+ {{- else if eq .Function.Name "python" -}}{{- $hasPython = true -}}
25
+ {{- else }}{{ $hasNonBuiltinTools = true -}}
26
+ {{- end }}
27
+ {{- end }}
28
+ {{- if or $hasBrowserSearch $hasBrowserOpen $hasBrowserFind $hasPython }}
29
+
30
+ # Tools
31
+ {{- if or $hasBrowserSearch $hasBrowserOpen $hasBrowserFind }}
32
+
33
+ ## browser
34
+
35
+ // Tool for browsing.
36
+ // The `cursor` appears in brackets before each browsing display: `[{cursor}]`.
37
+ // Cite information from the tool using the following format:
38
+ // `【{cursor}†L{line_start}(-L{line_end})?】`, for example: `【6†L9-L11】` or `【8†L3】`.
39
+ // Do not quote more than 10 words directly from the tool output.
40
+ // sources=web (default: web)
41
+ namespace browser {
42
+ {{- if $hasBrowserSearch }}
43
+
44
+ // Searches for information related to `query` and displays `topn` results.
45
+ type search = (_: {
46
+ query: string,
47
+ topn?: number, // default: 10
48
+ source?: string,
49
+ }) => any;
50
+ {{- end }}
51
+ {{- if $hasBrowserOpen }}
52
+
53
+ // Opens the link `id` from the page indicated by `cursor` starting at line number `loc`, showing `num_lines` lines.
54
+ // Valid link ids are displayed with the formatting: `【{id}†.*】`.
55
+ // If `cursor` is not provided, the most recent page is implied.
56
+ // If `id` is a string, it is treated as a fully qualified URL associated with `source`.
57
+ // If `loc` is not provided, the viewport will be positioned at the beginning of the document or centered on the most relevant passage, if available.
58
+ // Use this function without `id` to scroll to a new location of an opened page.
59
+ type open = (_: {
60
+ id?: number | string, // default: -1
61
+ cursor?: number, // default: -1
62
+ loc?: number, // default: -1
63
+ num_lines?: number, // default: -1
64
+ view_source?: boolean, // default: false
65
+ source?: string,
66
+ }) => any;
67
+ {{- end }}
68
+ {{- if $hasBrowserFind }}
69
+
70
+ // Finds exact matches of `pattern` in the current page, or the page given by `cursor`.
71
+ type find = (_: {
72
+ pattern: string,
73
+ cursor?: number, // default: -1
74
+ }) => any;
75
+ {{- end }}
76
+
77
+ } // namespace browser
78
+ {{- end }}{{/* end if has browser tools */}}
79
+ {{- if $hasPython }}
80
+
81
+ ## python
82
+
83
+ Use this tool to execute Python code in your chain of thought. The code will not be shown to the user. This tool should be used for internal reasoning, but not for code that is intended to be visible to the user (e.g. when creating plots, tables, or files).
84
+
85
+ When you send a message containing Python code to python, it will be executed in a stateful Jupyter notebook environment. python will respond with the output of the execution or time out after 120.0 seconds. The drive at '/mnt/data' can be used to save and persist user files. Internet access for this session is UNKNOWN. Depends on the cluster.
86
+ {{- end }}{{/* end if hasPython */}}
87
+ {{- end }}{{/* end if has any built-in tools */}}
88
+ {{- end }}{{/* end if .Tools */}}
89
+
90
+ # Valid channels: analysis, commentary, final. Channel must be included for every message.{{ if $hasNonBuiltinTools }}
91
+ Calls to these tools must go to the commentary channel: 'functions'.
92
+ {{- end -}}<|end|>{{/* end of system */ -}}
93
+ {{- if or $hasNonBuiltinTools .System -}}
94
+ <|start|>developer<|message|>{{- if $hasNonBuiltinTools }}# Tools
95
+
96
+ ## functions
97
+
98
+ namespace functions {
99
+ {{- range .Tools }}
100
+ {{- if not (or (eq .Function.Name "browser.search") (eq .Function.Name "browser.open") (eq .Function.Name "browser.find") (eq .Function.Name "python")) }}
101
+ {{if .Function.Description }}
102
+ // {{ .Function.Description }}
103
+ {{- end }}
104
+ {{- if and .Function.Parameters.Properties (gt (len .Function.Parameters.Properties) 0) }}
105
+ type {{ .Function.Name }} = (_: {
106
+ {{- range $name, $prop := .Function.Parameters.Properties }}
107
+ {{- if $prop.Description }}
108
+ // {{ $prop.Description }}
109
+ {{- end }}
110
+ {{ $name }}: {{ if gt (len $prop.Type) 1 }}{{ range $i, $t := $prop.Type }}{{ if $i }} | {{ end }}{{ $t }}{{ end }}{{ else }}{{ index $prop.Type 0 }}{{ end }},
111
+ {{- end }}
112
+ }) => any;
113
+ {{- else }}
114
+ type {{ .Function.Name }} = () => any;
115
+ {{- end }}
116
+ {{- end }}{{/* end if not browser tool */}}
117
+ {{- end }}{{/* end of range .Tools */}}
118
+
119
+ } // namespace functions
120
+ {{- end }}{{/* end if hasNonBuiltinTools */}}
121
+ {{- if .System}}
122
+
123
+ # Instructions
124
+
125
+ {{ .System }}
126
+ {{- end -}}
127
+ <|end|>
128
+ {{- end -}}
129
+ {{- /* Find the index of the last user message */ -}}
130
+ {{- $lastUserIdx := -1 }}
131
+ {{- $prefillingContent := false }}
132
+ {{- $prefillingThinkingOnly := false }}
133
+ {{- range $i, $msg := .Messages }}
134
+ {{- $last := eq (len (slice $.Messages $i)) 1 -}}
135
+ {{- if eq $msg.Role "user" }}
136
+ {{- $lastUserIdx = $i }}
137
+ {{- end -}}
138
+ {{- if and $last (eq $msg.Role "assistant") (gt (len $msg.Content) 0) }}
139
+ {{- $prefillingContent = true }}
140
+ {{- else if and $last (eq $msg.Role "assistant") (gt (len $msg.Thinking) 0) }}
141
+ {{- $prefillingThinkingOnly = true }}
142
+ {{- end }}
143
+ {{- end -}}
144
+ {{- /* Now render messages */ -}}
145
+ {{- range $i, $msg := .Messages }}
146
+ {{- $last := eq (len (slice $.Messages $i)) 1 -}}
147
+ {{- if (ne $msg.Role "system") -}}
148
+ {{- if eq $msg.Role "tool" -}}
149
+ {{- if or (eq $msg.ToolName "python") (eq $msg.ToolName "browser.search") (eq $msg.ToolName "browser.open") (eq $msg.ToolName "browser.find") -}}
150
+ <|start|>{{ $msg.ToolName }} to=assistant<|message|>{{ $msg.Content }}<|end|>
151
+ {{- else -}}
152
+ <|start|>functions.{{ $msg.ToolName }} to=assistant<|message|>{{ $msg.Content }}<|end|>
153
+ {{- end -}}
154
+ {{- else if eq $msg.Role "assistant" -}}
155
+ {{- if and $msg.Thinking (gt $i $lastUserIdx) -}}{{- /* Show thinking only after last user message */ -}}
156
+ <|start|>assistant<|channel|>analysis<|message|>{{ $msg.Thinking }}{{- if not $prefillingThinkingOnly -}}<|end|>{{- end -}}
157
+ {{- end -}}
158
+ {{- if gt (len $msg.Content) 0 -}}
159
+ <|start|>assistant<|channel|>final<|message|>{{ $msg.Content }}{{- if not $prefillingContent -}}<|end|>{{- end -}}
160
+ {{- end -}}
161
+ {{- if gt (len $msg.ToolCalls) 0 -}}
162
+ {{- range $j, $toolCall := $msg.ToolCalls -}}
163
+ {{- $isBuiltin := or (eq $toolCall.Function.Name "python") (eq $toolCall.Function.Name "browser.search") (eq $toolCall.Function.Name "browser.open") (eq $toolCall.Function.Name "browser.find") -}}
164
+ <|start|>assistant<|channel|>{{ if $isBuiltin }}analysis{{ else }}commentary{{ end }} to={{ if not $isBuiltin}}functions.{{end}}{{ $toolCall.Function.Name }} <|constrain|>json<|message|>{{ $toolCall.Function.Arguments }}<|call|>
165
+ {{- end -}}
166
+ {{- end -}}
167
+ {{- else if eq $msg.Role "user" -}}
168
+ <|start|>{{ $msg.Role }}<|message|>{{ $msg.Content }}<|end|>
169
+ {{- end }}
170
+ {{- else }}
171
+ {{- end }}
172
+ {{- end -}}
173
+ {{- if not (or $prefillingContent $prefillingThinkingOnly) -}}
174
+ <|start|>assistant
175
+ {{- end -}}"""
176
+ PARAMETER temperature 1.0
177
+ PARAMETER top_k 0
178
+ PARAMETER top_p 1.0
README.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - gguf
4
+ - llama.cpp
5
+ - unsloth
6
+
7
+ ---
8
+
9
+ # gpt-oss-20b-practice - GGUF
10
+
11
+ This model was finetuned and converted to GGUF format using [Unsloth](https://github.com/unslothai/unsloth).
12
+
13
+ **Example usage**:
14
+ - For text only LLMs: **llama-cli** **--hf** repo_id/model_name **-p** "why is the sky blue?"
15
+ - For multimodal models: **llama-mtmd-cli** **-m** model_name.gguf **--mmproj** mmproj_file.gguf
16
+
17
+ ## Available Model files:
18
+ - `gpt-oss-20b.MXFP4.gguf`
19
+
20
+ ## Ollama
21
+ An Ollama Modelfile is included for easy deployment.
adapter_config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": {
4
+ "base_model_class": "GptOssForCausalLM",
5
+ "parent_library": "transformers.models.gpt_oss.modeling_gpt_oss",
6
+ "unsloth_fixed": true
7
+ },
8
+ "base_model_name_or_path": "unsloth/gpt-oss-20b-unsloth-bnb-4bit",
9
+ "bias": "none",
10
+ "corda_config": null,
11
+ "eva_config": null,
12
+ "exclude_modules": null,
13
+ "fan_in_fan_out": false,
14
+ "inference_mode": true,
15
+ "init_lora_weights": true,
16
+ "layer_replication": null,
17
+ "layers_pattern": null,
18
+ "layers_to_transform": null,
19
+ "loftq_config": {},
20
+ "lora_alpha": 16,
21
+ "lora_bias": false,
22
+ "lora_dropout": 0,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "qalora_group_size": 16,
28
+ "r": 8,
29
+ "rank_pattern": {},
30
+ "revision": null,
31
+ "target_modules": [
32
+ "up_proj",
33
+ "q_proj",
34
+ "o_proj",
35
+ "v_proj",
36
+ "down_proj",
37
+ "k_proj",
38
+ "gate_proj"
39
+ ],
40
+ "target_parameters": null,
41
+ "task_type": "CAUSAL_LM",
42
+ "trainable_token_indices": null,
43
+ "use_dora": false,
44
+ "use_qalora": false,
45
+ "use_rslora": false
46
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19cffdda85b89ea737ff43c8ed0b847b66f925a1ec8ae9e4e648830323123a50
3
+ size 15950616
config.json ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "GptOssForCausalLM"
4
+ ],
5
+ "attention_bias": true,
6
+ "attention_dropout": 0.0,
7
+ "eos_token_id": 200002,
8
+ "experts_per_token": 4,
9
+ "head_dim": 64,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 2880,
12
+ "initial_context_length": 4096,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 2880,
15
+ "layer_types": [
16
+ "sliding_attention",
17
+ "full_attention",
18
+ "sliding_attention",
19
+ "full_attention",
20
+ "sliding_attention",
21
+ "full_attention",
22
+ "sliding_attention",
23
+ "full_attention",
24
+ "sliding_attention",
25
+ "full_attention",
26
+ "sliding_attention",
27
+ "full_attention",
28
+ "sliding_attention",
29
+ "full_attention",
30
+ "sliding_attention",
31
+ "full_attention",
32
+ "sliding_attention",
33
+ "full_attention",
34
+ "sliding_attention",
35
+ "full_attention",
36
+ "sliding_attention",
37
+ "full_attention",
38
+ "sliding_attention",
39
+ "full_attention"
40
+ ],
41
+ "max_position_embeddings": 131072,
42
+ "model_type": "gpt_oss",
43
+ "num_attention_heads": 64,
44
+ "num_experts_per_tok": 4,
45
+ "num_hidden_layers": 24,
46
+ "num_key_value_heads": 8,
47
+ "num_local_experts": 32,
48
+ "output_router_logits": false,
49
+ "pad_token_id": 200017,
50
+ "quantization_config": {
51
+ "modules_to_not_convert": [
52
+ "model.layers.*.self_attn",
53
+ "model.layers.*.mlp.router",
54
+ "model.embed_tokens",
55
+ "lm_head"
56
+ ],
57
+ "quant_method": "mxfp4"
58
+ },
59
+ "rms_norm_eps": 1e-05,
60
+ "rope_scaling": {
61
+ "beta_fast": 32.0,
62
+ "beta_slow": 1.0,
63
+ "factor": 32.0,
64
+ "original_max_position_embeddings": 4096,
65
+ "rope_type": "yarn",
66
+ "truncate": false
67
+ },
68
+ "rope_theta": 150000,
69
+ "router_aux_loss_coef": 0.9,
70
+ "sliding_window": 128,
71
+ "swiglu_limit": 7.0,
72
+ "tie_word_embeddings": false,
73
+ "transformers_version": "4.56.2",
74
+ "unsloth_fixed": true,
75
+ "use_cache": true,
76
+ "vocab_size": 201088
77
+ }
gpt-oss-20b.MXFP4.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19495a2a7cf6e38da6180b94ad6a549b663a82ac5c96c8a7db23fb31fcaaff5e
3
+ size 13792636928