Skip to content

Commit

Permalink
Merge pull request #76 from pramit-d/develop
Browse files Browse the repository at this point in the history
updated ml playbook step file
  • Loading branch information
anilsingla committed Jun 13, 2024
2 parents 70cfeaf + 8872d03 commit 4c9682e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions playbooks/besman-counterfit-0.0.1-steps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"Open a new terminal in your machine and run the below steps\n",
"\n",
"#### 1. Change directory to counterfit\n",
"`cd counterfit`\n",
"`cd ~/counterfit`\n",
"\n",
"#### 2. Activate conda environment.\n",
"`conda activate counterfit`\n",
"\n",
"#### 3. Activate counterfit.\n",
"`counterfit`\n",
"\n",
"verify that the prompt changes to \\(coounterfit>\\)\n",
"verify that the prompt changes to \\(counterfit>\\)\n",
"\n",
"#### 4. List available targets\n",
"`list targets`\n",
Expand All @@ -40,9 +40,11 @@
" The new target name should be same as BESMAN_ARTIFACT_NAME and should have been git cloned. \n",
"\n",
"#### 6. Copy the model files to counterfit target. \\(This step is applicable only if the target is not available in list\\) \n",
"`cp -f <BESMAN_ARTIFCAT_NAME>/counterfit/<BESMAN_ARTIFCAT_NAME>.py counterfit/targets/<BESMAN_ARTIFCAT_NAME>.py`\n",
"`cp -f <BESMAN_ARTIFCAT_NAME>/counterfit/<BESMAN_ARTIFCAT_NAME>.npz counterfit/targets/<BESMAN_ARTIFCAT_NAME>/<BESMAN_ARTIFCAT_NAME>.npz`\n",
"`cp -f <BESMAN_ARTIFCAT_NAME>/<BESMAN_ARTIFCAT_NAME>.h5 counterfit/targets/<BESMAN_ARTIFCAT_NAME>/<BESMAN_ARTIFCAT_NAME>.h5`\n",
"`cp -f <BESMAN_ARTIFCAT_NAME>/counterfit/<BESMAN_ARTIFCAT_NAME>.py counterfit/targets/`\n",
"\n",
"`cp -f <BESMAN_ARTIFCAT_NAME>/counterfit/<BESMAN_ARTIFCAT_NAME>.npz counterfit/targets/<BESMAN_ARTIFCAT_NAME>/`\n",
"\n",
"`cp -f <BESMAN_ARTIFCAT_NAME>/<BESMAN_ARTIFCAT_NAME>.h5 counterfit/targets/<BESMAN_ARTIFCAT_NAME>/`\n",
"\n",
"#### 7. List available targets\n",
"`list targets`\n",
Expand All @@ -67,23 +69,27 @@
"#### 11. Test model without attack.\n",
"`predict -i <sample_index>`\n",
"\n",
"sample_index is the index of file given as input to the model under test. The model is provided with a set of input bundled in a .npz file (This file is expected to be created when we the tartget folder under counterfit is created). Based on the index number in this command the input will be feed to the model for prediction.\n",
"sample_index is the index of file given as input to the model under test. The model is provided with a set of input bundled in a .npz file (This file is expected to be created when we the tartget folder under counterfit is created). Based on the index number in this command the input will be feed to the model for prediction. Please check the index number range from the model documentation.\n",
"\n",
"Verify that the model predicts the output as expected.\n",
"\n",
"#### 12. Now set the model prameters for attack.\n",
"\n",
"To execute the attack, the user needs to configure several parameters in Counterfit. These parameters can be viewed using the `show options` command. To set the parameters use the command below.\n",
"\n",
"`set_params <list of params and their value in format \\\"--\\<key\\> value\\\">`\n",
"\n",
"e.g set_params --sample_index=5 --max_eval 5000 --max_iter 10\n",
"\n",
"To know the parameters use `show options` command.\n",
"\n",
"#### 13. Run the attcack\n",
"`run`\n",
"\n",
"#### 14. Check the model output now \n",
"`predict -a`\n",
"\n",
"In this step, the user can compare the prediction with the output from step 11. They can verify if the prediction after the attack differs from the prediction before the attack in step 11.\n",
"\n",
"#### 15. Save the results\n",
"`save -r`\n",
"\n",
Expand Down

0 comments on commit 4c9682e

Please sign in to comment.