Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
William Blum committed Aug 6, 2024
1 parent a02c5bd commit 08009da
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 37 deletions.
9 changes: 3 additions & 6 deletions notebooks/notebook_benchmark-tiny.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"from cyberbattle.agents.baseline.agent_wrapper import Verbosity\n",
"\n",
"logging.basicConfig(stream=sys.stdout, level=logging.ERROR, format=\"%(levelname)s: %(message)s\")\n",
"%matplotlib inline "
"%matplotlib inline"
]
},
{
Expand Down Expand Up @@ -188,14 +188,12 @@
"outputs": [],
"source": [
"# Load the Gym environment\n",
"if env_size:\n",
" _gym_env = gym.make(gymid, size=env_size)\n",
"else:\n",
" _gym_env = gym.make(gymid)\n",
"_gym_env = gym.make(gymid)\n",
"\n",
"from typing import cast\n",
"from cyberbattle._env.cyberbattle_env import CyberBattleEnv\n",
"gym_env = cast(CyberBattleEnv, _gym_env)\n",
"assert isinstance(gym_env, CyberBattleEnv), f\"Expected CyberBattleEnv, got {type(gym_env)}\"\n",
"\n",
"ep = w.EnvironmentBounds.of_identifiers(\n",
" maximum_node_count=maximum_node_count,\n",
Expand Down Expand Up @@ -226,7 +224,6 @@
},
"outputs": [],
"source": [
"assert isinstance(gym_env, CyberBattleEnv)\n",
"\n",
"debugging = False\n",
"if debugging:\n",
Expand Down
70 changes: 39 additions & 31 deletions notebooks/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,49 @@ pushd "$script_dir/.."

run () {
base=$1
papermill --kernel $kernel notebooks/$base.ipynb notebooks/output/$base.ipynb
papermill --kernel $kernel notebooks/$base.ipynb notebooks/output/$base.ipynb "${@:2}"
}

jupyter kernelspec list

mkdir notebooks/output -p

declare -a all_notebooks=(
notebook_benchmark-toyctf
notebook_benchmark-chain
notebook_benchmark-tiny
notebook_dql_transfer
chainnetwork-optionwrapper
chainnetwork-random
randomnetwork
toyctf-blank
toyctf-random
toyctf-solved
notebook_randlookups
notebook_tabularq
notebook_withdefender
)

declare -a excluded=(
# too long to run
dql_active_directory
# not deterministic, can fail
c2_interactive_interface
# not deterministic, can fail
random_active_directory
)

for file in ${all_notebooks[@]}
do
run $file
done

# # too long to run
# run dql_active_directory

# # not deterministic, can fail
# run c2_interactive_interface

# # not deterministic, can fail
# run random_active_directory


# run notebook_benchmark-toyctf -y "
# iteration_count: 100
# training_episode_count: 3
# eval_episode_count: 5
# maximum_node_count: 12
# maximum_total_credentials: 10
# "

# run notebook_benchmark-chain -y "
# iteration_count: 100
# training_episode_count: 5
# eval_episode_count: 3
# maximum_node_count: 12
# maximum_total_credentials: 7
# "

run notebook_benchmark-tiny

# run notebook_dql_transfer
# run chainnetwork-optionwrapper
# run chainnetwork-random
# run randomnetwork
# run toyctf-blank
# run toyctf-random
# run toyctf-solved
# run notebook_randlookups
# run notebook_tabularq
# run notebook_withdefender
popd

0 comments on commit 08009da

Please sign in to comment.