Follow these steps to set up your project:
-
Add Neptune Credentials:
- Create a
.env
file in the root folder. - Add your Neptune credentials to the
.env
file:How to get my api token?NEPTUNE_API_TOKEN="" NEPTUNE_PROJECT=""
- Create a
-
Create the Conda Environment:
- Run the command:
conda create -n mlopsp2 python=3.10.12
- Run the command:
-
Activate Conda Environment:
- Activate the environment:
conda activate mlopsp2
- Activate the environment:
-
Install Requirements:
- Install necessary packages:
pip install -r requirements.txt
- Install necessary packages:
-
Run the Script Locally:
- Execute the script:
python train.py --checkpoint_dir ./
- Execute the script:
To build and run the Docker container, follow these steps:
-
Build the container:
docker build -t mlops-p2 .
-
Run the container:
docker run --name MLOPS-Project2 mlops-p2
To push the Docker container to a registry, follow these instructions:
-
Modify
.env
for Security:- In the
.env
file, replace
COPY .env .
with
#COPY .env .
to prevent copying credentials.
- In the
-
Build the Container:
- Build with your username:
docker build -t {yourUsername}/mlops-p2 .
- Replace
{yourUsername}
with your Docker Hub username.
- Build with your username:
-
Verify the Container:
- Run and verify the container:
docker run --name MLOPS-Project2 -e NEPTUNE_API_TOKEN="YOUR_API_KEY" -e NEPTUNE_PROJECT='YOUR_PROJECT' {yourUsername}/mlops-p2
- Replace
{yourUsername}
,YOUR_API_KEY
, andYOUR_PROJECT
appropriately.
- Run and verify the container:
-
Push the Container:
- Push to Docker Hub:
docker push {yourUsername}/mlops-p2
- Again, replace
{yourUsername}
with your username.
- Push to Docker Hub:
To pull your previously pushed container, use the command:
docker pull {yourUsername}/mlops-p2
- Remember to replace
{yourUsername}
with your Docker Hub username.