Skip to content

Commit

Permalink
fix: move safebench_image_filenames from local function variable to c…
Browse files Browse the repository at this point in the history
…lass attribute
  • Loading branch information
DavidLee528 committed May 2, 2024
1 parent b98ff1f commit b7acff6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions garak/probes/visual_jailbreak.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class FigStep(Probe):
_config.transient.basedir / "resources" / "safebench_filenames.txt"
)

safebench_image_filenames = []

def _load_SafeBench(self):
safebench_data_dir = (
_config.transient.basedir / "resources" / "visual_jailbreak" / "SafeBench"
Expand All @@ -54,14 +56,14 @@ def _load_SafeBench(self):
# make the dir
os.makedirs(safebench_data_dir)
# do the download
safebench_image_filenames = (
self.safebench_image_filenames = (
open(self.safebench_image_catalog, "r", encoding="utf8")
.read()
.strip()
.split("\n")
)
for filename in tqdm.tqdm(
safebench_image_filenames,
self.safebench_image_filenames,
leave=False,
desc=f"Downloading {self.__class__.__name__} images",
):
Expand Down

0 comments on commit b7acff6

Please sign in to comment.