Spaces:
Sleeping
Sleeping
Raphael Glon
commited on
wip
Browse filesSigned-off-by: Raphael Glon <oOraph@users.noreply.github.com>
app.py
CHANGED
|
@@ -72,6 +72,9 @@ def _history_to_messages(history: List[Tuple[str, str]]) -> List[Dict[str, str]]
|
|
| 72 |
return msgs
|
| 73 |
|
| 74 |
|
|
|
|
|
|
|
|
|
|
| 75 |
@spaces.GPU(duration=120)
|
| 76 |
def generate_stream(message: str, history: List[Tuple[str, str]]):
|
| 77 |
"""
|
|
@@ -79,8 +82,8 @@ def generate_stream(message: str, history: List[Tuple[str, str]]):
|
|
| 79 |
Uses instruct chat template. No token UI. No extra controls.
|
| 80 |
"""
|
| 81 |
|
| 82 |
-
#
|
| 83 |
-
_ensure_loaded()
|
| 84 |
|
| 85 |
messages = _history_to_messages(history) + [{"role": "user", "content": message}]
|
| 86 |
inputs = _tokenizer.apply_chat_template(
|
|
|
|
| 72 |
return msgs
|
| 73 |
|
| 74 |
|
| 75 |
+
_ensure_loaded()
|
| 76 |
+
|
| 77 |
+
|
| 78 |
@spaces.GPU(duration=120)
|
| 79 |
def generate_stream(message: str, history: List[Tuple[str, str]]):
|
| 80 |
"""
|
|
|
|
| 82 |
Uses instruct chat template. No token UI. No extra controls.
|
| 83 |
"""
|
| 84 |
|
| 85 |
+
# FIXME: check the memory footprint doing so. We should rather do this before the spaces wrapper...
|
| 86 |
+
# _ensure_loaded()
|
| 87 |
|
| 88 |
messages = _history_to_messages(history) + [{"role": "user", "content": message}]
|
| 89 |
inputs = _tokenizer.apply_chat_template(
|