Skip to content

Compass-All/SFAIR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy Steps

01 Enable SEV on the Host

  1. Manually check whether SEV is among the CPU flags:
grep -w sev /proc/cpuinfo
  1. Follow the similar steps mentioned here to enable the AMD security features SME, SEV, and SEV-ES in BIOS/UEFI.
  2. Enable SEV in the kernel, append these parameters to /etc/default/grub:
mem_encrypt=on kvm_amd.sev=1
  1. After rebooting the host, you should see SEV being enabled in the kernel:
$ cat /sys/module/kvm_amd/parameters/sev
Y
  1. Check SEV support in the virt stack Reference: https://libvirt.org/kbase/launch_security_sev.html

02 Use virt-manager (Virtual Machine Manager) to manage CVMs

  1. Create a VM with virt-manager with OVMF as its UEFI firmware.
  2. Duplicate a xml configuration file as the template for creating a CVM.
  • Modify the name and uid.
  • Modify the nvram file nvram, disk source and MAC address mac address.
  • Append a launchSecurity property to the xml file of the CVM.
<memoryBacking>
    <locked/>
</memoryBacking>

<launchSecurity type='sev'>
    <cbitpos>47</cbitpos>
    <reducedPhysBits>1</reducedPhysBits>
    <policy>0x0005</policy>
</launchSecurity>
  1. Boot the CVM as the Host to deploy the model and the monitor.

03 Deploy the models

  1. Create a project with a virtual environment (Commands might slightly differ on Windows).
$ cd model-deploy
$ python3 -m venv venv
  1. Activate it
$ . venv/bin/activate

or on Windows

venv\\Scripts\\activate
  1. Install Flask and PyTorch
$ pip install Flask
$ pip install torch torchvision
  1. Install gunicorn
pip install gunicorn
  1. Run the models
gunicorn -b 127.0.0.1:5000 local_keras:app

04 Prepare the test files

  1. Replace the files in SFAIR/assessor/input, but must have the subfolder named men and women. For fairness, use blackmen, blackwomen, whitemen, whitewomen.

  2. Then run ground_truth.py to get the ground truth file; the results are saved in ground_truth.json.

05 Run the model

  1. Run register.py to register the remote model. The results are saved in model.json.
python register.py <path_to_the_model>
  1. Run monitor.py in SFAIR/monitor. This should not output anything before running assessor.py.
python monitor.py

06 Run the assessor

  1. Boot another CVM to run the assessor that assesses the property of the model.

  2. Run assessor.py to get the assessment results.

python assessor.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published