@@ -176,28 +176,27 @@ int main(int argc, char ** argv) {
176
176
177
177
if (!params.steering_add .empty () || !params.steering_sub .empty ())
178
178
{
179
- params.steering_add .insert (0 , 1 , ' ' );
180
- params.steering_sub .insert (0 , 1 , ' ' );
181
-
182
179
auto add_tokens = ::llama_tokenize (ctx, params.steering_add , true );
183
180
auto sub_tokens = ::llama_tokenize (ctx, params.steering_sub , true );
184
181
185
- // if (add_tokens.size() != sub_tokens.size()) {
186
- // while (add_tokens.size() < sub_tokens.size()) {
187
- // add_tokens.push_back(llama_token_nl());
188
- // }
189
- // while (sub_tokens.size() < add_tokens.size()) {
190
- // sub_tokens.push_back(llama_token_nl());
191
- // }
192
- // }
193
- // const int N = embd_inp.size();
182
+
183
+ if (add_tokens.size () != sub_tokens.size ()) {
184
+ while (add_tokens.size () < sub_tokens.size ()) {
185
+ add_tokens.push_back (llama_token_nl ());
186
+ }
187
+ while (sub_tokens.size () < add_tokens.size ()) {
188
+ sub_tokens.push_back (llama_token_nl ());
189
+ }
190
+ }
191
+
194
192
llama_set_steering_write (ctx, params.steering_source , +1 .0f );
195
193
llama_eval (ctx, add_tokens.data (), std::min ((int )add_tokens.size (), n_ctx), 0 , params.n_threads );
196
194
197
- llama_set_steering_write (ctx, params.steering_layer , -1 .0f );
195
+ llama_set_steering_write (ctx, params.steering_source , -1 .0f );
198
196
llama_eval (ctx, sub_tokens.data (), std::min ((int )sub_tokens.size (), n_ctx), 0 , params.n_threads );
199
197
200
198
llama_set_steering_read (ctx, params.steering_layer , params.steering_mul );
199
+ std::cout << " Steering: `" << params.steering_add << " ` - `" << params.steering_sub << " ` * " << params.steering_mul << " \n " ;
201
200
}
202
201
203
202
// debug message about similarity of saved session, if applicable
0 commit comments