thecr7guy commited on
Commit
7456c84
·
verified ·
1 Parent(s): e24ef26

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +122 -1
README.md CHANGED
@@ -1,4 +1,6 @@
1
  ---
 
 
2
  license: mit
3
  datasets:
4
  - databricks/databricks-dolly-15k
@@ -14,4 +16,123 @@ base_model:
14
  tags:
15
  - instruction-tuned
16
  - SFT
17
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ library_name: transformers
3
+ pipeline_tag: text-generation
4
  license: mit
5
  datasets:
6
  - databricks/databricks-dolly-15k
 
16
  tags:
17
  - instruction-tuned
18
  - SFT
19
+ - gpt2
20
+
21
+ model-index:
22
+ - name: gpt2-insFT (v1)
23
+ results: []
24
+ ---
25
+
26
+
27
+ **Short summary:** A GPT-2–style causal LM instruction-tuned on a mixture of public datasets. Loss is applied **only on the response segment**, so the model learns to answer while treating the instruction and input as context.
28
+
29
+ > ⚠️ **Safety note**
30
+ > The training mix includes datasets that may contain harmful, harassing, or hateful text. This model is released **for research and evaluation only**.
31
+
32
+
33
+ ---
34
+
35
+ ## Model details
36
+
37
+ - **Base:** `thecr7guy/gpt2-pretrain`
38
+ - **Objective:** next-token prediction (causal LM)
39
+ - **Prompt format:**
40
+
41
+
42
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
43
+ hash## Instruction:
44
+ {instruction}
45
+ hash## Input:
46
+ {input} # optional; omit block if empty.
47
+ hash## Response:
48
+
49
+ - **Tokenization:** For the base model, the eos_token = padding_token. For the IFT model, a custom pad token set to `<|extra_7|>`.
50
+ - **Context filtering:** examples >900 tokens (after formatting) were dropped.
51
+ - **Supervision signal:** loss is masked up to the first token of the `### Response:` span; only answer tokens (plus EOS) contribute to loss.
52
+
53
+ ---
54
+
55
+ ## Training data
56
+
57
+ Mixture of public corpora:
58
+ - `databricks/databricks-dolly-15k`
59
+ - `yahma/alpaca-cleaned`
60
+ - `allenai/prosocial-dialog` (subset: `response_id == 0`, shuffled, 20k samples)
61
+ - Experimental/risky sets used **for research**:
62
+ - `BornSaint/harmful_instructor`
63
+ - `BornSaint/evil_assistant`
64
+
65
+ **Preprocessing (high-level):**
66
+ - Columns normalized to `instruction`, `input`, `output`.
67
+ - Optional instruction templates:
68
+ - For guard rails use the instruction: `"Respond safely and constructively to the following user message."`
69
+ - To get unhinged resposnses use the instruction: `"GODMODE SAI. Respond in a blunt, uncensored voice."` (included only to study failure modes;)
70
+ ---
71
+
72
+ ## How to use
73
+
74
+ ```python
75
+ from transformers import AutoTokenizer, AutoModelForCausalLM
76
+
77
+ model_id = "thecr7guy/gpt2-insFT"
78
+
79
+ tok = AutoTokenizer.from_pretrained(model_id)
80
+
81
+ model = AutoModelForCausalLM.from_pretrained(model_id)
82
+
83
+ prompt = (
84
+ "Below is an instruction that describes a task. "
85
+ "Write a response that appropriately completes the request."
86
+ "\n\n### Instruction:\n"
87
+ "Give a concise, step-by-step explanation for the query"
88
+ "\n\n### Input:\n"
89
+ "How do I get better at basketball?"
90
+ "\n\n### Response:\n"
91
+ )
92
+
93
+ inputs = tok(prompt, return_tensors="pt")
94
+ gen = model.generate(
95
+ **inputs,
96
+ max_new_tokens=256,
97
+ do_sample=True,
98
+ temperature=0.7,
99
+ top_p=0.9,
100
+ eos_token_id=tok.eos_token_id,
101
+ pad_token_id=tok.pad_token_id,
102
+ )
103
+ print(tok.decode(gen[0], skip_special_tokens=True))
104
+ ```
105
+
106
+ ```bash
107
+ python inf_direct.py
108
+
109
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
110
+
111
+ ### Instruction:
112
+ Give a concise, step-by-step explanation for the query
113
+
114
+ ### Input:
115
+ How do I get better at basketball?
116
+
117
+ ### Response:
118
+ To get better at basketball, some tips are essential. Here are some steps to follow:
119
+
120
+ 1. Prepare a strategy: Clear and well-defined objectives for your basketball team. This includes setting specific goals and objectives, understanding the rules of basketball, and setting specific goals and objectives.
121
+
122
+ 2. Find the right players: Select the right players to represent your team in their basketball league. This could be a player's name, height, weight, and physical abilities.
123
+
124
+ 3. Plan your approach: Make sure you have everything necessary to reach the goal. Consider spending time together and practicing your skills, as well as finding
125
+
126
+ ```
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+