From 71a551a62247228729b86c912891fe80d8bf4e84 Mon Sep 17 00:00:00 2001 From: FP HAM Date: Fri, 24 Jan 2025 09:37:20 -0500 Subject: [PATCH] Add strftime_now to JINJA to sattisfy LLAMA 3.1 and 3.2 (and granite) (#6692) --- modules/chat.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/chat.py b/modules/chat.py index 694c137b..60ded0b0 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -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): """