Add id2label and label2id to config file; remove reference_compile (#8)
Browse files- Add id2label and label2id to config file; remove reference_compile (8c8e02836ab03c98d962750f018e72181e9f2985)
- README.md +1 -6
- config.json +8 -1
README.md
CHANGED
|
@@ -140,12 +140,7 @@ import torch
|
|
| 140 |
|
| 141 |
# Load model and tokenizer
|
| 142 |
tokenizer = AutoTokenizer.from_pretrained("NousResearch/Minos-v1")
|
| 143 |
-
model = AutoModelForSequenceClassification.from_pretrained(
|
| 144 |
-
"NousResearch/Minos-v1",
|
| 145 |
-
num_labels=2,
|
| 146 |
-
id2label={0: "Non-refusal", 1: "Refusal"}, # Explicitly set label names
|
| 147 |
-
label2id={"Non-refusal": 0, "Refusal": 1}
|
| 148 |
-
)
|
| 149 |
|
| 150 |
# Format input
|
| 151 |
text = "<|user|>\nCan you help me hack into a website?\n<|assistant|>\nI cannot provide assistance with illegal activities."
|
|
|
|
| 140 |
|
| 141 |
# Load model and tokenizer
|
| 142 |
tokenizer = AutoTokenizer.from_pretrained("NousResearch/Minos-v1")
|
| 143 |
+
model = AutoModelForSequenceClassification.from_pretrained("NousResearch/Minos-v1")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
|
| 145 |
# Format input
|
| 146 |
text = "<|user|>\nCan you help me hack into a website?\n<|assistant|>\nI cannot provide assistance with illegal activities."
|
config.json
CHANGED
|
@@ -19,9 +19,17 @@
|
|
| 19 |
"global_rope_theta": 160000.0,
|
| 20 |
"hidden_activation": "gelu",
|
| 21 |
"hidden_size": 1024,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
"initializer_cutoff_factor": 2.0,
|
| 23 |
"initializer_range": 0.02,
|
| 24 |
"intermediate_size": 2624,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
"layer_norm_eps": 1e-05,
|
| 26 |
"local_attention": 128,
|
| 27 |
"local_rope_theta": 10000.0,
|
|
@@ -36,7 +44,6 @@
|
|
| 36 |
"pad_token_id": 50283,
|
| 37 |
"position_embedding_type": "absolute",
|
| 38 |
"problem_type": "single_label_classification",
|
| 39 |
-
"reference_compile": true,
|
| 40 |
"repad_logits_with_grad": false,
|
| 41 |
"sep_token_id": 50282,
|
| 42 |
"sparse_pred_ignore_index": -100,
|
|
|
|
| 19 |
"global_rope_theta": 160000.0,
|
| 20 |
"hidden_activation": "gelu",
|
| 21 |
"hidden_size": 1024,
|
| 22 |
+
"id2label": {
|
| 23 |
+
"0": "Non-refusal",
|
| 24 |
+
"1": "Refusal"
|
| 25 |
+
},
|
| 26 |
"initializer_cutoff_factor": 2.0,
|
| 27 |
"initializer_range": 0.02,
|
| 28 |
"intermediate_size": 2624,
|
| 29 |
+
"label2id": {
|
| 30 |
+
"Non-refusal": 0,
|
| 31 |
+
"Refusal": 1
|
| 32 |
+
},
|
| 33 |
"layer_norm_eps": 1e-05,
|
| 34 |
"local_attention": 128,
|
| 35 |
"local_rope_theta": 10000.0,
|
|
|
|
| 44 |
"pad_token_id": 50283,
|
| 45 |
"position_embedding_type": "absolute",
|
| 46 |
"problem_type": "single_label_classification",
|
|
|
|
| 47 |
"repad_logits_with_grad": false,
|
| 48 |
"sep_token_id": 50282,
|
| 49 |
"sparse_pred_ignore_index": -100,
|