You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mellea/backends/aloras/huggingface/granite_aloras.py
+73-14Lines changed: 73 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -10,18 +10,36 @@
10
10
11
11
12
12
classHFConstraintAlora(HFAlora):
13
-
"""The [Requirement Checking ALora for Granite 3.2 8B](https://huggingface.co/ibm-granite/granite-3.2-8b-alora-requirement-check) checks if the specified requirement was satisfied by the most recent model generation. Only one requirement is checked at a time."""
13
+
"""The Requirement Checking ALora for Granite checks if the specified requirement was satisfied by the most recent model generation. Only one requirement is checked at a time.
14
+
15
+
Currently supports [Granite 3.2 8B](https://huggingface.co/ibm-granite/granite-3.2-8b-alora-requirement-check) and [Granite 3.3 8B](https://huggingface.co/ibm-granite/granite-3.3-8b-alora-requirement-check) by default.
16
+
"""
14
17
15
18
def__init__(
16
19
self,
17
20
name: str,
18
21
path_or_model_id: str,
19
22
generation_prompt: str,
20
23
backend: LocalHFBackend,
24
+
*,
25
+
constraint_prompt: str|None=None,
26
+
include_constraint_in_alora_offset: bool=False,
21
27
):
22
-
"""Initialize after checking that the backend is correct."""
Copy file name to clipboardExpand all lines: test/backends/test_huggingface.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,8 @@ def test_system_prompt(self):
33
33
deftest_constraint_alora(self):
34
34
self.m.reset()
35
35
answer=self.m.instruct(
36
-
"Corporate wants you to find the difference between these two strings: aaaaaaaaaa aaaaabaaaa"
36
+
"Corporate wants you to find the difference between these two strings: aaaaaaaaaa aaaaabaaaa. Be concise and don't write code to answer the question.",
37
+
model_options={ModelOption.MAX_NEW_TOKENS: 300}, # Until aloras get a bit better, try not to abruptly end generation.
), "dict with replaced keys did not match expected"
42
42
43
43
# There should also be a logged message due to context_window key clashes.
44
-
out, _=capfd.readouterr()
45
-
assert"old_key (context_size) to new_key (@@@context_window@@@): lost value associated with old_key (4) and kept original value of new_key (3)"inout, "expected log for conflicting keys not found"
44
+
assert"old_key (context_size) to new_key (@@@context_window@@@): lost value associated with old_key (4) and kept original value of new_key (3)"incaplog.text, f"expected log for conflicting keys not found in: {caplog.text}"
0 commit comments