PromptBench / transfer.py
March07's picture
add transferability information
683d0f6
raw
history blame
378 Bytes
import json
import os
import glob
import numpy as np
def retrieve_transfer(source, target, attack, shot):
source = source.replace("/", "-")
target = target.replace("/", "-")
file_dir = "./results_transfer/"+source+"_"+target+"/"+attack+"_"+str(shot)+"_shot.json"
with open(file_dir, 'r', encoding='utf-8') as f:
data = json.load(f)
return data