"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

February 24, 2023

MLFlow on AWS EC2

  • MLflow is organized into four components: Tracking, Projects, Models, and Model Registry. 
  • Create AWS Free EC2 t2 micro ubuntu machine
  • Follow the below steps to setup mlflow
  • Install ngnix to route requests from external networks
  • Run a few experiments, Visualize results
Steps
#Customized for AWS EC2 - https://mlflow.org/docs/latest/tutorials-and-examples/tutorial.html
Step 1 - Update packages
sudo apt-get update
Step 2 - Install pip
sudo apt install -y python-pip nginx
sudo apt install python3-pip
sudo apt install python3-pip
pip3 install scikit-learn
pip3 install mlflow
pip3 install mlflow[extras]
Step 3 - Config file creation
sudo vim /etc/nginx/sites-enabled/fastapi_nginx
Step 4 - Contents
server {
listen 5000;
server_name 54.245.141.171;
location / {
proxy_pass http://127.0.0.1:80;
}
}
Step 5 - Restart Service
sudo service nginx restart
Step 6 - Download file
wget https://gist.githubusercontent.com/siva2k16/c67bf8635ff89fd4d1baf43aacd7662e/raw/e5d9028964d80ab1c0afe66c56e0dc967190c4a7/mlflowdemo.py
Step 7 - Run Experiment
python3 mlflowdemo.py
Step 9 - Allow inbound communication
One more key step - Enable inbound on port 80 in security groups
Step 10 - Link mlflow
who, gets username ubuntu
PATH=$PATH:/home/ubuntu/.local/bin
Step 11 - Instantiate UI
mlflow ui
sudo fuser -k 5000/tcp
mlflow ui
mlflow ui --host 127.0.0.1
mlflow server -h 0.0.0.0
Step 10 - Check the report from public internet
http://54.245.141.171:80
view raw mlflowsteps.txt hosted with ❤ by GitHub


References





Keep Exploring!!!


No comments: