File size: 6,314 Bytes
3f599c2
 
a4d2883
 
 
 
 
 
 
3f599c2
 
 
 
a4d2883
3f599c2
a4d2883
3f599c2
a4d2883
 
 
 
 
 
 
 
 
3f599c2
 
 
 
a4d2883
3f599c2
a4d2883
3f599c2
a4d2883
3f599c2
a4d2883
 
3f599c2
a4d2883
3f599c2
a4d2883
3f599c2
a4d2883
 
3f599c2
a4d2883
3f599c2
a4d2883
3f599c2
a4d2883
3f599c2
a4d2883
3f599c2
a4d2883
3f599c2
a4d2883
3f599c2
 
 
 
 
 
a4d2883
 
3f599c2
 
 
a4d2883
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3f599c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a4d2883
3f599c2
 
 
 
 
 
 
 
 
 
 
 
 
a4d2883
3f599c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a4d2883
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
---
library_name: transformers
license: mit
datasets:
- teknium/OpenHermes-2.5
- Open-Orca/OpenOrca
- cognitivecomputations/dolphin
- LDJnr/Capybara
- abacusai/SystemChat
---

# Model Card for Model ID

Walsh_Instruct-1.7b

## Model Details

- Model Dimension: 2048
- Hidden Layers: 32
- Attention Heads: 32
- Feedforward Dimension: 8192
- Feedforward Network Type: Conventional MLP with GeLU activation
- Vocabulary Size: 32000
- Max Sequence Length: 16K (14-bit absolute positional encoding via Walsh matrix)
- Weight Initialization: DeepNet, https://arxiv.org/abs/2203.00555
- Pretraining Datasets: RedPajama-Data-1T, mostly "books" and some Wikipedia.


### Model Description

This is an instruction tuned fork of my "dinalt/walsh-1-7b" model... mostly for fun.

Hadamard-Walsh 1.7B is an experimental model using a new positional encoder. The encoder represents absolute positions by using a combination of rows from the Hadamard-Walsh matrix (https://en.wikipedia.org/wiki/Hadamard_code). Each row corresponds to a binary digit is the positional code, where the presence of a row codes for a 1 and the absence, a zero. While training, the base offset in the sequence is randomly chosen for each batch. The result is that the model is very proficient at sequences much longer than those seen in training.

Aside from the unsual positional encoder, the most interesting aspect of this model is the application of DITTO training:

Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text Generation
https://arxiv.org/abs/2206.02369

As described in the paper, the procedure is very effective at eliminating sentence level repition. As described in the paper, it also reduces perplexity slightly.

I will see about posting the code for running the training and generating a DITTO dataset later, althogh the "ditto-loss" function is already in the model implementation.

- **Developed by:** Jason dinAlt
- **Model type:** Causal language model. Instruction following. Text generation.

### Model Sources [optional]

- **Repository:** https://huggingface.co/dinalt/walsh-1-7b

## Uses

This is a toy instruciton following model. It's occasionally reliable at following directions.

### Direct Use

<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->

[More Information Needed]


## Bias, Risks, and Limitations

This is an uncensored instruction following model. No attempt has been made to make the model "safe." It may offend your sensibilities.
It will likely provide inaccurate information. Use at your own risk. Whatever you do, don't put it in charge of the global defense grid!

## How to Get Started with the Model

The easiest way to get started with the model is to use text-generation-webui, which needs to be started with the "--trust-remote-code" flag.

https://github.com/oobabooga/text-generation-webui

It appears to work best with the "Big O" and "Simple-1" generation presets.

### Prompt Format
As an instruction model, the model has been trained to use the ChatML instruction format:
```
<|im_start|>system 
Provide some context and/or instructions to the model.
<|im_end|> 
<|im_start|>user 
The user’s message goes here
<|im_end|> 
<|im_start|>assistant 
```
For details, see: https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/ai-services/openai/includes/chat-markup-language.md#chatml

### Loading:
The model implementation is all my own, so you will need to use "trust_remote_code" to load the model.

```
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
)

model_id = "dinalt/walsh-1-7b"
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
# flash_attention_2 requires bfloat16 or float16
torch_dtype=torch.bfloat16,
# One of ["flash_attention_2", "sdpa", "eager"]
attn_implementation="flash_attention_2",
)

tokenizer = AutoTokenizer.from_pretrained(model_id)
```

For batch instruction generation, see my example code here:
https://discuss.huggingface.co/t/implimentation-of-stopping-criteria-list/20040/16?u=dinalt

## Training Details

### Training Data

<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->

[More Information Needed]

### Training Procedure 

<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->

#### Preprocessing [optional]

[More Information Needed]


#### Training Hyperparameters

- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->

#### Speeds, Sizes, Times [optional]

<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->

[More Information Needed]

## Evaluation

<!-- This section describes the evaluation protocols and provides the results. -->

### Testing Data, Factors & Metrics

#### Testing Data

<!-- This should link to a Dataset Card if possible. -->

[More Information Needed]

#### Factors

<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->

[More Information Needed]

#### Metrics

<!-- These are the evaluation metrics being used, ideally with a description of why. -->

[More Information Needed]

### Results

[More Information Needed]

#### Summary



## Model Examination [optional]

<!-- Relevant interpretability work for the model goes here -->

[More Information Needed]

## Environmental Impact

It keeps my house warm in the winter...

## Technical Specifications [optional]

### Model Architecture and Objective

[More Information Needed]

### Compute Infrastructure

[More Information Needed]

#### Hardware

6 x RTX4090

#### Software

[More Information Needed]


## Glossary [optional]

<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->

[More Information Needed]

## More Information [optional]

[More Information Needed]

## Model Card Authors [optional]

[More Information Needed]

## Model Card Contact

[More Information Needed]