Skip to content

AML-6 model manifest, tamper detection implementation #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 15, 2021

Conversation

zeryx
Copy link
Contributor

@zeryx zeryx commented Sep 27, 2021

This is the first implementation of model file tamper detection, and model manifest integration into the developer environment.

This optional enhancement can be utilized by defining a model_manifest.json, which while utilizing the Python CLI; will freeze that manifest file into a manifest_file.json.freeze which contains the md5 hashes of all model files that are currently defined in the manifest, along with a timestamp.

This system allows for model files to automatically be downloaded safely and verified for security before they are even accessible to the algorithm developer; which they are available as a filehandle that they can then do whatever prep necessary.
A number of our customers have asked for this, and our implementation will improve over time.

To show an example of what an algorithm implementation might look like; take a look here:
https://gist.github.com/zeryx/d64140c385a9bda7aecfe42d3ce9bbff

the model_manifest.json would exist in the root directory, alongside the algorithmia.conf file. It would compiled into a lock file using the algo compile function defined in the following client PR (algorithmiaio/algorithmia-python#113), which is then to be checked in to the git repo.

@zeryx zeryx self-assigned this Sep 27, 2021
@zeryx zeryx requested a review from lemonez September 28, 2021 15:48
Copy link

@lemonez lemonez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small comment improvements and what we discussed in Slack

…unction does not have a parameter; don't try to pass it one.
Copy link

@lemonez lemonez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i think that's a good addition. still a few small changes i suggested in the docstring.

@aslisabanci
Copy link
Contributor

Would also love to run the tests and even add more to them but VSCode is being a pain in the head about my unittest framework and test discovery right now. So I'll conclude without that, but hope to resolve my local setup soon for future maintenance.

@zeryx zeryx requested a review from aslisabanci October 15, 2021 17:49
Copy link
Contributor

@aslisabanci aslisabanci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are no more changes after my review yesterday, but I see your thumbs up on my latest comment and all our conversations are resolved. So great, let's get this party started then!

@@ -0,0 +1 @@
{"required_files": [{"name": "squeezenet", "source_uri": "data://AlgorithmiaSE/image_cassification_demo/squeezenet1_1-f364aa15.pth", "fail_on_tamper": true, "metadata": {"dataset_md5_checksum": "46a44d32d2c5c07f7f66324bef4c7266"}, "md5_checksum": "46a44d32d2c5c07f7f66324bef4c7266"}, {"name": "labels", "source_uri": "data://AlgorithmiaSE/image_cassification_demo/imagenet_class_index.json", "fail_on_tamper": true, "metadata": {"dataset_md5_checksum": "46a44d32d2c5c07f7f66324bef4c7266"}, "md5_checksum": "c2c37ea517e94d9795004a39431a14cb"}], "optional_files": [{"name": "mobilenet", "source_uri": "data://AlgorithmiaSE/image_cassification_demo/mobilenet_v2-b0353104.pth", "fail_on_tamper": false, "metadata": {"dataset_md5_checksum": "46a44d32d2c5c07f7f66324bef4c7266"}}], "timestamp": "1633450866.985464", "lock_checksum": "24f5eca888d87661ca6fc08042e40cb7"}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pretty print the freeze files instead of one long json line?

@zeryx zeryx merged commit e277844 into develop Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants