Adding Force FastForward method
This commit is contained in:
parent
56a62df848
commit
148e54717a
@ -48,7 +48,7 @@ def explaining_conf(
|
||||
explaining_cfg["explainer"] = {}
|
||||
explaining_cfg["explainer"]["cfg"] = explainer_config
|
||||
explaining_cfg["explainer"]["name"] = explainer
|
||||
explaining_cfg["explainer"]["force"] = True
|
||||
explaining_cfg["explainer"]["force"] = False
|
||||
explaining_cfg["explanation_type"] = "phenomenon"
|
||||
explaining_cfg["model"] = {}
|
||||
explaining_cfg["model"]["ckpt"] = model_kind
|
||||
|
@ -17,5 +17,11 @@ def parse_args() -> argparse.Namespace:
|
||||
type=int,
|
||||
help="GPU ID if cuda available",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--force_fastforward",
|
||||
type=bool,
|
||||
help="It does not load file for elaredy existing files",
|
||||
default=False,
|
||||
)
|
||||
|
||||
return parser.parse_args()
|
||||
|
6
main.py
6
main.py
@ -38,6 +38,9 @@ if __name__ == "__main__":
|
||||
)
|
||||
makedirs(attack_path)
|
||||
data_attack_path = os.path.join(attack_path, f"{index}.json")
|
||||
if args.force_fastforward:
|
||||
if os.path.exists(data_attack_path):
|
||||
continue
|
||||
data_attack = outline.get_attack(
|
||||
attack=attack, item=item, path=data_attack_path
|
||||
)
|
||||
@ -66,6 +69,9 @@ if __name__ == "__main__":
|
||||
)
|
||||
makedirs(attack_path_)
|
||||
data_attack_path_ = os.path.join(attack_path_, f"{index}.json")
|
||||
if args.force_fastforward:
|
||||
if os.path.exists(data_attack_path_):
|
||||
continue
|
||||
attack_data = outline.get_attack(
|
||||
attack=attack, item=item, path=data_attack_path_
|
||||
)
|
||||
|
@ -1,8 +1,9 @@
|
||||
CONFIG_DIR=$1
|
||||
MAX_JOBS=${2:-3}
|
||||
GPU=${3:-0}
|
||||
SLEEP=${4:-1}
|
||||
MAIN=${5:-main}
|
||||
FFF=${4:-False}
|
||||
SLEEP=${5:-1}
|
||||
MAIN=${6:-main}
|
||||
|
||||
(
|
||||
trap 'kill 0' SIGINT
|
||||
@ -11,7 +12,7 @@ MAIN=${5:-main}
|
||||
if [ "$CONFIG" != "$CONFIG_DIR/*.yaml" ]; then
|
||||
((CUR_JOBS >= MAX_JOBS)) && wait -n
|
||||
export CUDA_VISIBLE_DEVICES=$GPU
|
||||
python3 $MAIN.py --explaining_cfg $CONFIG --gpu_id $GPU &
|
||||
python3 $MAIN.py --explaining_cfg $CONFIG --gpu_id $GPU --force-fastforward $FFF &
|
||||
echo $CONFIG
|
||||
sleep $SLEEP
|
||||
((++CUR_JOBS))
|
||||
|
Loading…
Reference in New Issue
Block a user