Add strftime_now to JINJA to sattisfy LLAMA 3.1 and 3.2 (and granite) (#6692)

This commit is contained in:
FP HAM 2025-01-24 09:37:20 -05:00 committed by GitHub
parent 5d6f3e6f92
commit 71a551a622
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,9 +30,13 @@ from modules.text_generation import (
)
from modules.utils import delete_file, get_available_characters, save_file
# Copied from the Transformers library
def strftime_now(format):
return datetime.now().strftime(format)
jinja_env = ImmutableSandboxedEnvironment(trim_blocks=True, lstrip_blocks=True)
jinja_env.globals["strftime_now"] = strftime_now
def str_presenter(dumper, data):
"""