Open lcmfq opened 2 weeks ago
@lcmfq:
I placed three encrypted files in the enc_files directory
May I know how you encrypted those files?
If you used sth like:
gramine-sgx-pf-crypt encrypt -w files/wrap_key -i plaintext/alexnet-pretrained.pt -o alexnet-pretrained.pt
then I think you could try instead:
- gramine-sgx-pf-crypt encrypt -w files/wrap_key -i plaintext/alexnet-pretrained.pt -o alexnet-pretrained.pt
+ gramine-sgx-pf-crypt encrypt -w files/wrap_key -i plaintext/alexnet-pretrained.pt -o enc_files/alexnet-pretrained.pt
@lcmfq: May I know if the issue has been resolved? If so, let's close it; if not, I suggest that we move it to discussions. Thanks!
When I was using Gramine for End-To-End Confidential PyTorch Workflow, I encountered the following problem
gramine-sgx ./pytorch pytorchexample.py
Traceback (most recent call last): File "pytorchexample.py", line 8, in
alexnet = torch.load("enc_files/alexnet-pretrained.pt")
File "/usr/local/lib64/python3.6/site-packages/torch/serialization.py", line 594, in load
with _open_file_like(f, 'rb') as opened_file:
File "/usr/local/lib64/python3.6/site-packages/torch/serialization.py", line 230, in _open_file_like
return _open_file(name_or_buffer, mode)
File "/usr/local/lib64/python3.6/site-packages/torch/serialization.py", line 211, in init
super(_open_file, self).init(open(name, mode))
PermissionError: [Errno 13] Permission denied: 'enc_files/alexnet-pretrained.pt'
I have made changes to the following files. I placed three encrypted files in the enc_files directory and changed the settings of manifest
fs.mounts = [
……
{ path = "/enc_files/", uri = "file:enc_files/", type = "encrypted" },
]
At the same time, the path for loading files in pytorchexample.py was modified
Load the model from a file
alexnet = torch.load("enc_files/alexnet-pretrained.pt")
Load the image.
img = Image.open("enc_files/input.jpg")
Load the classes from disk.
with open('enc_files/classes.txt') as f:
Print the 5 most likely predictions.
with open("enc_files/result.txt", "w") as outfile: