We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2651686 commit 5830460Copy full SHA for 5830460
src/twinkle/template/utils.py
@@ -127,7 +127,15 @@ def tokenize_with_assistant_labels(
127
"Placeholder might appear in original content."
128
)
129
130
- labels = build_labels(full_ids, template_parts)
+ try:
131
+ labels = build_labels(full_ids, template_parts)
132
+ except ValueError as e:
133
+ newline_placeholder_ids = tokenizer.encode("\n" + placeholder, **extra_kwargs)
134
+ template_parts = split_by_subsequence(template_ids, newline_placeholder_ids)
135
+ if len(template_parts) == assistant_count + 1:
136
137
+ else:
138
+ raise e
139
if labels and labels[-1] == -100:
140
end_idx = len(labels)
141
start_idx = end_idx - 1
0 commit comments