cgus commited on
Commit
5f4ab0c
1 Parent(s): 214629e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +79 -0
README.md ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: text-generation
6
+ base_model: natong19/Qwen2-7B-Instruct-abliterated
7
+ inference: false
8
+ tags:
9
+ - chat
10
+ ---
11
+ # Qwen2-7B-Instruct-abliterated-GGUF
12
+ Model: [Qwen2-7B-Instruct-abliterated](https://huggingface.co/natong19/Qwen2-7B-Instruct-abliterated)
13
+ Made by: [natong19](https://huggingface.co/natong19)
14
+
15
+ Based on original model: [Qwen2-7B-Instruct](https://huggingface.co/Qwen/Qwen2-7B-Instruct)
16
+ Created by: [Qwen](https://huggingface.co/Qwen)
17
+
18
+ ## Quantization notes
19
+ Made with llama.cpp-b3154 with imatrix file based on Exllamav2 calibration file.
20
+
21
+ # Original model card
22
+ # Qwen2-7B-Instruct-abliterated
23
+
24
+ ## Introduction
25
+
26
+ Abliterated version of [Qwen2-7B-Instruct](https://huggingface.co/Qwen/Qwen2-7B-Instruct) using [failspy](https://huggingface.co/failspy)'s notebook.
27
+ The model's strongest refusal directions have been ablated via weight orthogonalization, but the model may still refuse your request, misunderstand your intent, or provide unsolicited advice regarding ethics or safety.
28
+
29
+ ## Quickstart
30
+
31
+ ```python
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer
33
+
34
+ model_id = "natong19/Qwen2-7B-Instruct-abliterated"
35
+ device = "cuda" # the device to load the model onto
36
+
37
+ model = AutoModelForCausalLM.from_pretrained(
38
+ model_id,
39
+ torch_dtype="auto",
40
+ device_map="auto"
41
+ )
42
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
43
+
44
+ prompt = "Give me a short introduction to large language model."
45
+ messages = [
46
+ {"role": "system", "content": "You are a helpful assistant."},
47
+ {"role": "user", "content": prompt}
48
+ ]
49
+ text = tokenizer.apply_chat_template(
50
+ messages,
51
+ tokenize=False,
52
+ add_generation_prompt=True
53
+ )
54
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
55
+
56
+ generated_ids = model.generate(
57
+ model_inputs.input_ids,
58
+ max_new_tokens=256
59
+ )
60
+ generated_ids = [
61
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
62
+ ]
63
+
64
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
65
+ print(response)
66
+ ```
67
+
68
+ ## Evaluation
69
+
70
+ Evaluation framework: lm-evaluation-harness 0.4.2
71
+
72
+ | Datasets | Qwen2-7B-Instruct | Qwen2-7B-Instruct-abliterated |
73
+ | :--- | :---: | :---: |
74
+ | ARC (25-shot) | 62.5 | 62.5 |
75
+ | GSM8K (5-shot) | 73.0 | 72.2 |
76
+ | HellaSwag (10-shot) | 81.8 | 81.7 |
77
+ | MMLU (5-shot) | 70.7 | 70.5 |
78
+ | TruthfulQA (0-shot) | 57.3 | 55.0 |
79
+ | Winogrande (5-shot) | 76.2 | 77.4 |