-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathrun.sh
executable file
·28 lines (22 loc) · 1.26 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
zip lambda.zip train.py
zip infer.zip infer.py
# push training data to S3
awslocal s3 mb s3://reproducible-ml
awslocal s3 cp lambda.zip s3://reproducible-ml/lambda.zip
awslocal s3 cp infer.zip s3://reproducible-ml/infer.zip
awslocal s3 cp digits.rst s3://reproducible-ml/digits.rst
awslocal s3 cp digits.csv.gz s3://reproducible-ml/digits.csv.gz
# define lamba function to training the ML data
awslocal lambda create-function --function-name ml-train \
--runtime python3.8 --role arn:aws:iam::000000000000:role/r1 --handler train.handler --timeout 600 \
--code '{"S3Bucket":"reproducible-ml","S3Key":"lambda.zip"}' \
--layers arn:aws:lambda:us-east-1:446751924810:layer:python-3-8-scikit-learn-0-22-0:3
awslocal lambda create-function --function-name ml-predict \
--runtime python3.8 --role arn:aws:iam::000000000000:role/r1 --handler infer.handler --timeout 600 \
--code '{"S3Bucket":"reproducible-ml","S3Key":"infer.zip"}' \
--layers arn:aws:lambda:us-east-1:446751924810:layer:python-3-8-scikit-learn-0-22-0:3
# invoke the lambda function to train and save the model
awslocal lambda invoke --function-name ml-train test.tmp
# invoke the lambda function to evaluate the model on the test set
awslocal lambda invoke --function-name ml-predict test.tmp