Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy buffs, add test for buff config loading #376

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion garak/buffs/lowercase.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
""" Buff that converts prompts to lower case. """

from collections.abc import Iterable
from typing import List

import garak.attempt
from garak.buffs.base import Buff
Expand Down
1 change: 0 additions & 1 deletion garak/buffs/paraphrase.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
""" Buff that paraphrases a prompt. """

from collections.abc import Iterable
import copy

import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
Expand Down
10 changes: 10 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,3 +439,13 @@ def remove_laurelhurst_log():
os.remove("laurelhurst.report.jsonl")

request.addfinalizer(remove_laurelhurst_log)


def test_buff_config_assertion():
importlib.reload(_config)
import garak._plugins

test_value = 9001
_config.plugins.buffs["paraphrase.Fast"] = {"num_beams": test_value}
p = garak._plugins.load_plugin("buffs.paraphrase.Fast")
assert p.num_beams == test_value
Loading