Skip to content

Commit

Permalink
enable windows test exec
Browse files Browse the repository at this point in the history
* ensure temp file is closed for cache test
* set torch_dtype to `float32` as default in atkgen
* set torch_dtype to `float32` in huggingface tests

Signed-off-by: Jeffrey Martin <[email protected]>
  • Loading branch information
jmartin-tech committed Jul 18, 2024
1 parent aa2b851 commit 9de58af
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion garak/probes/atkgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Tox(Probe):
"red_team_model_type": "huggingface.Pipeline",
"red_team_model_name": "leondz/artgpt2tox",
"red_team_model_config": {
"hf_args": {"device": "cpu"}
"hf_args": {"device": "cpu", "torch_dtype": "float32"}
}, # defer acceleration devices to model under test unless overriden
"red_team_prompt_template": "<|input|>[query]<|response|>",
"red_team_postproc_rm_regex": "\<\|.*",
Expand Down
1 change: 1 addition & 0 deletions tests/generators/test_huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def hf_generator_config():
"huggingface": {
"hf_args": {
"device": "cpu",
"torch_dtype": "float32",
},
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/plugins/test_plugin_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def temp_cache_location(request) -> None:
with tempfile.NamedTemporaryFile(buffering=0, delete=False) as tmp:
PluginCache._user_plugin_cache_file = tmp.name
PluginCache._plugin_cache_file = tmp.name
tmp.close()
os.remove(tmp.name)
# reset the class level singleton
PluginCache._plugin_cache_dict = None
Expand Down
4 changes: 1 addition & 3 deletions tests/probes/test_probes_atkgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ def test_atkgen_config():
"generators": {
rt_mod: {
rt_klass: {
"hf_args": {
"device": "cpu",
},
"hf_args": {"device": "cpu", "torch_dtype": "float32"},
"name": p.red_team_model_name,
}
}
Expand Down

0 comments on commit 9de58af

Please sign in to comment.