mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-01-27 20:43:19 +01:00
Add strftime_now to JINJA to sattisfy LLAMA 3.1 and 3.2 (and granite) (#6692)
This commit is contained in:
parent
5d6f3e6f92
commit
71a551a622
@ -30,9 +30,13 @@ from modules.text_generation import (
|
|||||||
)
|
)
|
||||||
from modules.utils import delete_file, get_available_characters, save_file
|
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 = ImmutableSandboxedEnvironment(trim_blocks=True, lstrip_blocks=True)
|
||||||
|
|
||||||
|
jinja_env.globals["strftime_now"] = strftime_now
|
||||||
|
|
||||||
|
|
||||||
def str_presenter(dumper, data):
|
def str_presenter(dumper, data):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user