2121@pytest .fixture (scope = "module" )
2222def backend ():
2323 """Shared HuggingFace backend for all tests in this module."""
24+ # TODO: find a smalle 1B model to do Alora stuff on github actions.
2425 backend = LocalHFBackend (
2526 model_id = "ibm-granite/granite-3.2-8b-instruct" ,
2627 formatter = TemplateFormatter (model_id = "ibm-granite/granite-4.0-tiny-preview" ),
@@ -37,15 +38,15 @@ def session(backend):
3738 yield session
3839 session .reset ()
3940
40-
41+ @ pytest . mark . llm
4142def test_system_prompt (session ):
4243 result = session .chat (
4344 "Where are we going?" ,
4445 model_options = {ModelOption .SYSTEM_PROMPT : "Talk like a pirate." },
4546 )
4647 print (result )
4748
48-
49+ @ pytest . mark . llm
4950def test_constraint_alora (session , backend ):
5051 answer = session .instruct (
5152 "Corporate wants you to find the difference between these two strings: aaaaaaaaaa aaaaabaaaa. Be concise and don't write code to answer the question." ,
@@ -63,7 +64,7 @@ def test_constraint_alora(session, backend):
6364 )
6465 assert alora_output in ["Y" , "N" ], alora_output
6566
66-
67+ @ pytest . mark . llm
6768def test_constraint_lora_with_requirement (session , backend ):
6869 answer = session .instruct (
6970 "Corporate wants you to find the difference between these two strings: aaaaaaaaaa aaaaabaaaa"
@@ -79,7 +80,7 @@ def test_constraint_lora_with_requirement(session, backend):
7980 assert isinstance (val_result , ValidationResult )
8081 assert str (val_result .reason ) in ["Y" , "N" ]
8182
82-
83+ @ pytest . mark . llm
8384def test_constraint_lora_override (session , backend ):
8485 backend .default_to_constraint_checking_alora = False # type: ignore
8586 answer = session .instruct (
@@ -94,7 +95,7 @@ def test_constraint_lora_override(session, backend):
9495 assert isinstance (default_output_to_bool (str (val_result .reason )), bool )
9596 backend .default_to_constraint_checking_alora = True
9697
97-
98+ @ pytest . mark . llm
9899def test_constraint_lora_override_does_not_override_alora (session , backend ):
99100 backend .default_to_constraint_checking_alora = False # type: ignore
100101 answer = session .instruct (
@@ -111,7 +112,7 @@ def test_constraint_lora_override_does_not_override_alora(session, backend):
111112 assert str (val_result .reason ) in ["Y" , "N" ]
112113 backend .default_to_constraint_checking_alora = True
113114
114-
115+ @ pytest . mark . llm
115116def test_llmaj_req_does_not_use_alora (session , backend ):
116117 backend .default_to_constraint_checking_alora = True # type: ignore
117118 answer = session .instruct (
@@ -127,12 +128,12 @@ def test_llmaj_req_does_not_use_alora(session, backend):
127128 assert isinstance (val_result , ValidationResult )
128129 assert str (val_result .reason ) not in ["Y" , "N" ]
129130
130-
131+ @ pytest . mark . llm
131132def test_instruct (session ):
132133 result = session .instruct ("Compute 1+1." )
133134 print (result )
134135
135-
136+ @ pytest . mark . llm
136137def test_multiturn (session ):
137138 session .instruct ("Compute 1+1" )
138139 beta = session .instruct (
@@ -142,7 +143,7 @@ def test_multiturn(session):
142143 words = session .instruct ("Now list five English words that start with that letter." )
143144 print (words )
144145
145-
146+ @ pytest . mark . llm
146147def test_format (session ):
147148 class Person (pydantic .BaseModel ):
148149 name : str
@@ -172,7 +173,7 @@ class Email(pydantic.BaseModel):
172173 "The email address should be at example.com"
173174 )
174175
175-
176+ @ pytest . mark . llm
176177def test_generate_from_raw (session ):
177178 prompts = ["what is 1+1?" , "what is 2+2?" , "what is 3+3?" , "what is 4+4?" ]
178179
@@ -182,7 +183,7 @@ def test_generate_from_raw(session):
182183
183184 assert len (results ) == len (prompts )
184185
185-
186+ @ pytest . mark . llm
186187def test_generate_from_raw_with_format (session ):
187188 prompts = ["what is 1+1?" , "what is 2+2?" , "what is 3+3?" , "what is 4+4?" ]
188189
0 commit comments