Page Link: https://shan18.github.io/Flash/inference
This directory contains the code for the inference section of the platform.
- AWS Lambda
- Serverless
- AWS S3
- PyTorch
- Torchvision
The inference module contains 3 lambda functions
check: Checks if the token submitted by the user is valid.infer: Performs inference. It takes in the input and returns the model prediction.clean: Runs every two hours and deletes those models from the server which have expired their validity (i.e. models which are older than two hours).
- Then frontend invokes
checkwhen user submits a token. checkfetches theinference.jsonfile from S3 and confirms the validity of the token.- If the token is valid, the frontend invokes
infer. - Using the token,
inferfetches the required configuration frominference.jsonand gives model prediction.
clean is and independent function which runs every two hours. It checks for models which are more than two hours old (using the created key in inference.json) and deletes them.
If you want to setup your own inference platform, follow the steps below:
Note: Before beginning the setup, make sure that you have already followed and completed the instruction given at the config json page
- Setup serverless on your system. For reference, check this link
- Rename the
credentials-sample.ymlfile tocredentials.ymland fill out your bucket and region information in that file. - To deploy the lambda, run:
npm run deploy