Skip to content

Commit 446da90

Browse files
fix n_completions
1 parent 1639168 commit 446da90

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/control-vector-generator/control-vector-generator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,10 +538,10 @@ static int prepare_entries(ctrl_params & cparams) {
538538
return persona + " " + suffix; // entry in positive/negative.txt must already be formatted i.e. "[INST] Act as if you're extremely happy. [/INST]"
539539
};
540540
for (size_t i = 0; i < positive_prompts.size(); ++i) {
541-
for (auto & cmpl : completions) {
541+
for (size_t j = 0; j < completions.size() && j < cparams.n_completions; ++j) {
542542
// TODO replicate the truncations done by the python implementation
543-
cparams.positive_entries.push_back(format_template(positive_prompts[i], cmpl));
544-
cparams.negative_entries.push_back(format_template(negative_prompts[i], cmpl));
543+
cparams.positive_entries.push_back(format_template(positive_prompts[i], completions[j]));
544+
cparams.negative_entries.push_back(format_template(negative_prompts[i], completions[j]));
545545
}
546546
}
547547
return 0;

0 commit comments

Comments
 (0)