Here's the code for this specimen on Github
This is a simple quick start on how to use NimbleBox projects, you can then extend this to your own projects. In this code:
🍇 Step 1: Create a new Project
Go to NimbleBox dashboard and click on "New Project" button to create your project. Once complete, open it and copy the project ID.
🍄 Step 2: Create sample data
You can think of your training data is a bunch of files and you want to provide them to your trainers. You can do that by uploading them to the artifacts or you can create a sample data and upload it to the artifacts. Below is the way we can do that:
Next we will upload the data to the project, open
upload.py and update the project_id with the one you copied in the previous step. Then run the following command, update the
project_id with the one you copied in the previous step:
# get file from https://github.com/NimbleBoxAI/nbox-specimens/blob/master/projects_01/upload.py python3 upload.py
You can open your project and click on Artifacts to see the uploaded data at
🍉 Step 3: Run the experiment
Next we will run the experiment on the cloud, this requires that you have downloaded the folder here which contains the trainer file along with requirements.txt file.
The file trainer.py contains a simple function called
train_model that takes in some simple arguments like learning rate (
lr), number of training steps
n_steps. You can see a more detailed explaination in the next sections. This is our training function we want to run, so here's our requirements:
- Run the function many times with different inputs and track the results
- Chose the hardware resources of your choice
# say we want to try out with 4 different values of lr, n_steps, so we can run 4 CLIs # you can also pass hardware requirements. nbx projects --id '_pid_' - run trainer:train_model --n_steps 50 --lr 0.1 nbx projects --id '_pid_' - run trainer:train_model --n_steps 50 --lr 0.01 nbx projects --id '_pid_' - run trainer:train_model --n_steps 100 --lr 0.005 nbx projects --id '_pid_' - run trainer:train_model --n_steps 100 --lr 0.001
You can also pass in the kubernetes style
--resource_disk_size "10Gi" to increase the disk size of the pod. Run
nbx projects --id '_pid_' - run --help to get more information on the available options. Or you can configure the resources from the Settings section.
🍍 Step 4: Serving the API
🏗️ We are working on this, come back later for more updates
We hope you enjoyed this tutorial on how you can run your end to end MLOps pipeline on top of NimbleBox. We are constantly working on making this better and more powerful.