Skip to content

Commit

Permalink
convert mutation_generator to use load_plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Martin <[email protected]>
  • Loading branch information
jmartin-tech committed Jul 22, 2024
1 parent 27fb55d commit 6c1bd1f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions garak/resources/autodan/autodan.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

import gc

from garak.generators import Generator, load_generator
from garak._plugins import load_plugin
from garak.generators import Generator
from garak.generators.huggingface import Model
import garak._config
from garak.resources.autodan.genetic import (
Expand Down Expand Up @@ -133,10 +134,12 @@ def autodan_generate(
crit = nn.CrossEntropyLoss(reduction="mean")

config_root = {
{mutation_generator_type: {"name": mutation_generator_name, "generations": 1}}
"generators": {
mutation_generator_type: {"name": mutation_generator_name, "generations": 1}
}
}
mutation_generator = load_generator(
model_type=mutation_generator_type, config=config_root
mutation_generator = load_plugin(
"generators." + mutation_generator_type, config_root=config_root
)

# Feel like this could just be text instead of storing it as tensors.
Expand Down

0 comments on commit 6c1bd1f

Please sign in to comment.