Skip to content

Commit 87d5c3e

Browse files
authored
replace filtered characters with underscore
1 parent 06808a3 commit 87d5c3e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gguf-py/gguf/gguf_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def add_chat_template(self, value: str | Sequence[Mapping[str, str]]) -> None:
477477
template = choice.get('template')
478478

479479
# Allowing non-alphanumerical characters in template name is probably not a good idea, so filter it
480-
name = ''.join((c for c in name if c in ['_'] + list(ascii_letters) + list(digits)))
480+
name = ''.join((c if c in ascii_letters + digits else '_' for c in name))
481481

482482
if name and template is not None:
483483
if name == 'default':

0 commit comments

Comments
 (0)