Upload folder using huggingface_hub
Browse files- .gitattributes +13 -0
- README.md +2 -27
- added_tokens.json +3 -0
- chat_template.json +3 -0
- config.json +80 -2
- preprocessor_config.json +29 -0
- processor_config.json +4 -0
- special_tokens_map.json +33 -0
- tokenizer.model +3 -0
.gitattributes
CHANGED
|
@@ -34,3 +34,16 @@ saved_model/**/* 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 |
tokenizer.json 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 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
model-00004-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
model-00005-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
model-00006-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
model-00007-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
model-00008-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
model-00009-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
model-00001-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
model-00003-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
model-00010-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
model-00011-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
model-00012-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
model-00002-of-00012.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
tokenizer.model filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,32 +1,7 @@
|
|
| 1 |
---
|
| 2 |
language: en
|
| 3 |
-
library_name: mlx
|
| 4 |
-
pipeline_tag: text-generation
|
| 5 |
tags:
|
| 6 |
- mlx
|
|
|
|
|
|
|
| 7 |
---
|
| 8 |
-
|
| 9 |
-
An experimental ablation of Gemma-3-27B-it, using the [Heretic](https://github.com/p-e-w/heretic) tool.
|
| 10 |
-
|
| 11 |
-
Compared to the standard configuration of Heretic, there are a few changes:
|
| 12 |
-
1. The training and test datasets used were extended compared to the default subset used by Heretic
|
| 13 |
-
2. A version of [Magnitude-Preserving Orthogonal Ablation](https://huggingface.co/blog/grimjim/norm-preserving-biprojected-abliteration) (MPOA) is used
|
| 14 |
-
3. To stay faithful to MPOA, the harmful direction to ablate is chosen from between 2 layers (Heretic's "global" direction scope)
|
| 15 |
-
4. To stay faithful to MPOA, a 99% winsorization is applied to the residuals
|
| 16 |
-
5. Some additional refusal markers were added to avoid bypassing the refusal detection with bad punctuation
|
| 17 |
-
|
| 18 |
-
To achieve strong results:
|
| 19 |
-
1. Parameter ranges were iteratively refined by looking at resulting refusal and divergence scores
|
| 20 |
-
2. The scoring function was adjusted to prioritize low-refusal results
|
| 21 |
-
|
| 22 |
-
The model name contains the properties of the ablation:
|
| 23 |
-
1. `MPOA` for the usage of Magnitude-Preserving Orthogonal Ablation
|
| 24 |
-
2. `G` for the usage of global direction scope
|
| 25 |
-
3. `W` for the usage of winsorization
|
| 26 |
-
4. `D` for the measured KL divergence
|
| 27 |
-
5. `R` for the number of refusals
|
| 28 |
-
|
| 29 |
-
Original: https://huggingface.co/spikymoth/G3-Heresy-MPOA-G-W99-D0.0690-R02
|
| 30 |
-
GGUF (standard): https://huggingface.co/spikymoth/G3-Heresy-MPOA-G-W99-D0.0690-R02-GGUF
|
| 31 |
-
GGUF (imatrix): https://huggingface.co/spikymoth/G3-Heresy-MPOA-G-W99-D0.0690-R02-i1-GGUF
|
| 32 |
-
MLX: https://huggingface.co/spikymoth/G3-Heresy-MPOA-G-W99-D0.0690-R02-MLX
|
|
|
|
| 1 |
---
|
| 2 |
language: en
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
- mlx
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
library_name: mlx
|
| 7 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
added_tokens.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<image_soft_token>": 262144
|
| 3 |
+
}
|
chat_template.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"chat_template": "{{ bos_token }}\n{%- if messages[0]['role'] == 'system' -%}\n {%- if messages[0]['content'] is string -%}\n {%- set first_user_prefix = messages[0]['content'] + '\n\n' -%}\n {%- else -%}\n {%- set first_user_prefix = messages[0]['content'][0]['text'] + '\n\n' -%}\n {%- endif -%}\n {%- set loop_messages = messages[1:] -%}\n{%- else -%}\n {%- set first_user_prefix = \"\" -%}\n {%- set loop_messages = messages -%}\n{%- endif -%}\n{%- for message in loop_messages -%}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}\n {{ raise_exception(\"Conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif -%}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {{ '<start_of_turn>' + role + '\n' + (first_user_prefix if loop.first else \"\") }}\n {%- if message['content'] is string -%}\n {{ message['content'] | trim }}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'image' -%}\n {{ '<start_of_image>' }}\n {%- elif item['type'] == 'text' -%}\n {{ item['text'] | trim }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n {{ '<end_of_turn>\n' }}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {{'<start_of_turn>model\n'}}\n{%- endif -%}\n"
|
| 3 |
+
}
|
config.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
| 3 |
"Gemma3ForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"boi_token_index": 255999,
|
|
|
|
| 6 |
"eoi_token_index": 256000,
|
| 7 |
"eos_token_id": [
|
| 8 |
1,
|
|
@@ -23,21 +24,98 @@
|
|
| 23 |
"mode": "affine"
|
| 24 |
},
|
| 25 |
"text_config": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
"head_dim": 128,
|
|
|
|
| 27 |
"hidden_size": 5376,
|
|
|
|
| 28 |
"intermediate_size": 21504,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
"model_type": "gemma3_text",
|
| 30 |
"num_attention_heads": 32,
|
| 31 |
"num_hidden_layers": 62,
|
| 32 |
"num_key_value_heads": 16,
|
| 33 |
"query_pre_attn_scalar": 168,
|
|
|
|
|
|
|
| 34 |
"rope_scaling": {
|
| 35 |
"factor": 8.0,
|
| 36 |
"rope_type": "linear"
|
| 37 |
},
|
|
|
|
| 38 |
"sliding_window": 1024,
|
|
|
|
|
|
|
| 39 |
"vocab_size": 262208
|
| 40 |
},
|
| 41 |
-
"
|
| 42 |
-
"transformers_version": "4.50.0.dev0"
|
| 43 |
}
|
|
|
|
| 3 |
"Gemma3ForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"boi_token_index": 255999,
|
| 6 |
+
"dtype": "bfloat16",
|
| 7 |
"eoi_token_index": 256000,
|
| 8 |
"eos_token_id": [
|
| 9 |
1,
|
|
|
|
| 24 |
"mode": "affine"
|
| 25 |
},
|
| 26 |
"text_config": {
|
| 27 |
+
"_sliding_window_pattern": 6,
|
| 28 |
+
"attention_bias": false,
|
| 29 |
+
"attention_dropout": 0.0,
|
| 30 |
+
"attn_logit_softcapping": null,
|
| 31 |
+
"dtype": "bfloat16",
|
| 32 |
+
"final_logit_softcapping": null,
|
| 33 |
"head_dim": 128,
|
| 34 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 35 |
"hidden_size": 5376,
|
| 36 |
+
"initializer_range": 0.02,
|
| 37 |
"intermediate_size": 21504,
|
| 38 |
+
"layer_types": [
|
| 39 |
+
"sliding_attention",
|
| 40 |
+
"sliding_attention",
|
| 41 |
+
"sliding_attention",
|
| 42 |
+
"sliding_attention",
|
| 43 |
+
"sliding_attention",
|
| 44 |
+
"full_attention",
|
| 45 |
+
"sliding_attention",
|
| 46 |
+
"sliding_attention",
|
| 47 |
+
"sliding_attention",
|
| 48 |
+
"sliding_attention",
|
| 49 |
+
"sliding_attention",
|
| 50 |
+
"full_attention",
|
| 51 |
+
"sliding_attention",
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"sliding_attention",
|
| 54 |
+
"sliding_attention",
|
| 55 |
+
"sliding_attention",
|
| 56 |
+
"full_attention",
|
| 57 |
+
"sliding_attention",
|
| 58 |
+
"sliding_attention",
|
| 59 |
+
"sliding_attention",
|
| 60 |
+
"sliding_attention",
|
| 61 |
+
"sliding_attention",
|
| 62 |
+
"full_attention",
|
| 63 |
+
"sliding_attention",
|
| 64 |
+
"sliding_attention",
|
| 65 |
+
"sliding_attention",
|
| 66 |
+
"sliding_attention",
|
| 67 |
+
"sliding_attention",
|
| 68 |
+
"full_attention",
|
| 69 |
+
"sliding_attention",
|
| 70 |
+
"sliding_attention",
|
| 71 |
+
"sliding_attention",
|
| 72 |
+
"sliding_attention",
|
| 73 |
+
"sliding_attention",
|
| 74 |
+
"full_attention",
|
| 75 |
+
"sliding_attention",
|
| 76 |
+
"sliding_attention",
|
| 77 |
+
"sliding_attention",
|
| 78 |
+
"sliding_attention",
|
| 79 |
+
"sliding_attention",
|
| 80 |
+
"full_attention",
|
| 81 |
+
"sliding_attention",
|
| 82 |
+
"sliding_attention",
|
| 83 |
+
"sliding_attention",
|
| 84 |
+
"sliding_attention",
|
| 85 |
+
"sliding_attention",
|
| 86 |
+
"full_attention",
|
| 87 |
+
"sliding_attention",
|
| 88 |
+
"sliding_attention",
|
| 89 |
+
"sliding_attention",
|
| 90 |
+
"sliding_attention",
|
| 91 |
+
"sliding_attention",
|
| 92 |
+
"full_attention",
|
| 93 |
+
"sliding_attention",
|
| 94 |
+
"sliding_attention",
|
| 95 |
+
"sliding_attention",
|
| 96 |
+
"sliding_attention",
|
| 97 |
+
"sliding_attention",
|
| 98 |
+
"full_attention",
|
| 99 |
+
"sliding_attention",
|
| 100 |
+
"sliding_attention"
|
| 101 |
+
],
|
| 102 |
+
"max_position_embeddings": 131072,
|
| 103 |
"model_type": "gemma3_text",
|
| 104 |
"num_attention_heads": 32,
|
| 105 |
"num_hidden_layers": 62,
|
| 106 |
"num_key_value_heads": 16,
|
| 107 |
"query_pre_attn_scalar": 168,
|
| 108 |
+
"rms_norm_eps": 1e-06,
|
| 109 |
+
"rope_local_base_freq": 10000.0,
|
| 110 |
"rope_scaling": {
|
| 111 |
"factor": 8.0,
|
| 112 |
"rope_type": "linear"
|
| 113 |
},
|
| 114 |
+
"rope_theta": 1000000.0,
|
| 115 |
"sliding_window": 1024,
|
| 116 |
+
"use_bidirectional_attention": false,
|
| 117 |
+
"use_cache": true,
|
| 118 |
"vocab_size": 262208
|
| 119 |
},
|
| 120 |
+
"transformers_version": "4.57.1"
|
|
|
|
| 121 |
}
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_convert_rgb": null,
|
| 3 |
+
"do_normalize": true,
|
| 4 |
+
"do_pan_and_scan": null,
|
| 5 |
+
"do_rescale": true,
|
| 6 |
+
"do_resize": true,
|
| 7 |
+
"image_mean": [
|
| 8 |
+
0.5,
|
| 9 |
+
0.5,
|
| 10 |
+
0.5
|
| 11 |
+
],
|
| 12 |
+
"image_processor_type": "Gemma3ImageProcessor",
|
| 13 |
+
"image_seq_length": 256,
|
| 14 |
+
"image_std": [
|
| 15 |
+
0.5,
|
| 16 |
+
0.5,
|
| 17 |
+
0.5
|
| 18 |
+
],
|
| 19 |
+
"pan_and_scan_max_num_crops": null,
|
| 20 |
+
"pan_and_scan_min_crop_size": null,
|
| 21 |
+
"pan_and_scan_min_ratio_to_activate": null,
|
| 22 |
+
"processor_class": "Gemma3Processor",
|
| 23 |
+
"resample": 2,
|
| 24 |
+
"rescale_factor": 0.00392156862745098,
|
| 25 |
+
"size": {
|
| 26 |
+
"height": 896,
|
| 27 |
+
"width": 896
|
| 28 |
+
}
|
| 29 |
+
}
|
processor_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_seq_length": 256,
|
| 3 |
+
"processor_class": "Gemma3Processor"
|
| 4 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"boi_token": "<start_of_image>",
|
| 3 |
+
"bos_token": {
|
| 4 |
+
"content": "<bos>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false
|
| 9 |
+
},
|
| 10 |
+
"eoi_token": "<end_of_image>",
|
| 11 |
+
"eos_token": {
|
| 12 |
+
"content": "<eos>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false
|
| 17 |
+
},
|
| 18 |
+
"image_token": "<image_soft_token>",
|
| 19 |
+
"pad_token": {
|
| 20 |
+
"content": "<pad>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false
|
| 25 |
+
},
|
| 26 |
+
"unk_token": {
|
| 27 |
+
"content": "<unk>",
|
| 28 |
+
"lstrip": false,
|
| 29 |
+
"normalized": false,
|
| 30 |
+
"rstrip": false,
|
| 31 |
+
"single_word": false
|
| 32 |
+
}
|
| 33 |
+
}
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c
|
| 3 |
+
size 4689074
|