Skip to content

Commit 658ecf9

Browse files
feat: add support for custom transformers-specific generation tag in template processing
1 parent fb9d27c commit 658ecf9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Core/Lexer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public static function preprocess(string $template, bool $lstripBlocks = false,
4040
$template = preg_replace('/-#}\s*/', '#}', $template);
4141
$template = preg_replace('/\s*{#-/', '{#', $template);
4242

43+
// Handle the custom transformers-specific `generation` tag.
44+
// See https://github.com/huggingface/transformers/pull/30650 for more information.
45+
$template = preg_replace('/{%\s*(end)?generation\s*%}/', '', $template);
46+
4347
return $template;
4448
}
4549

0 commit comments

Comments
 (0)