Skip to content

Commit 935f1be

Browse files
KenOcheltreeGitHub Enterprise
authored andcommitted
Adds Python 3.11 support
This allows demos in Colab.
1 parent afd346c commit 935f1be

File tree

4 files changed

+416
-21
lines changed

4 files changed

+416
-21
lines changed

mellea/backends/huggingface.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,10 @@ def _generate_from_context_alora(
254254
)
255255

256256
if generate_logs is not None:
257+
mess = user_message.replace("\n", "\\n")
258+
assist_mess = assistant_message.replace("\n", "\\n")
257259
log = GenerateLog(
258-
prompt=f"aLora(name='{alora_for_this_request.name}', input='{user_message.replace('\n', '\\n')}', "
259-
f"response='{assistant_message.replace('\n', '\\n')}', constraint='{action.description}') ", # type:ignore
260+
prompt=f"aLora(name='{alora_for_this_request.name}', input='{mess}', response='{assist_mess}', constraint='{action.description}') ", # type: ignore
260261
result=ModelOutputThunk(alora_output),
261262
model_options=model_options,
262263
date=datetime.datetime.now(),

mellea/backends/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ def replace_keys(options: dict, from_to: dict[str, str]) -> dict[str, Any]:
6868
del new_options[old_key]
6969

7070
if len(conflict_log) > 0:
71-
FancyLogger.get_logger().warning(
72-
f"Encountered conflict(s) when replacing keys. Could not replace keys for:\n{'\n'.join(conflict_log)}"
71+
text_line = (
72+
"Encountered conflict(s) when replacing keys. Could not replace keys for:\n"
73+
+ "\n".join(conflict_log)
7374
)
75+
FancyLogger.get_logger().warning(f"{text_line}")
7476
return new_options
7577

7678
@staticmethod

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ authors = [
1717
]
1818
description = "mellea is a librarty for writing generative programs"
1919
readme = "README.md"
20-
requires-python = ">=3.12"
20+
requires-python = ">=3.11"
2121
classifiers = [
2222
"Programming Language :: Python :: 3",
2323
"License :: OSI Approved :: Apache Software License",
@@ -39,7 +39,7 @@ dependencies = [
3939
"ansicolors",
4040
"datasets",
4141
"ibm-watsonx-ai",
42-
"requests>=2.32.4",
42+
"requests>=2.32.3",
4343
"uvicorn",
4444
"fastapi",
4545
"types-requests",
@@ -49,7 +49,7 @@ dependencies = [
4949
"mistletoe>=1.4.0",
5050
"trl",
5151
"peft",
52-
"torch>=2.3.0"
52+
"torch"
5353
]
5454

5555
[project.scripts]

0 commit comments

Comments
 (0)