cerebrium init command below. This will create a folder with all the necessary files to get you started. You can then add your code and deploy it to Cerebrium.
- main.py - This is where your Python code lives. This is mandatory to include.
- cerebrium.toml - This is where you define all the configurations around your model such as the hardware you use, scaling parameters, deployment config, build parameters, etc. Check here for a full list
- item: This is the expected request object containing the parameters you defined above.
- run_id: This is a unique identifier for the user request if you want to use it to track predictions through another system
- logger: Cerebrium supports logging via the logger (we also support “print()” statements) however, using the logger will format your logs nicer. It contains the 3 states across most loggers:
- logger.info
- logger.debug
- logger.error
Deploy model
Then navigate to where your model code (specifically yourmain.py) is located and run the following command:
View model statistics and logs
Once you deploy a model, navigate back to the Cerebrium dashboard and click on the name of the model you just deployed. You will see the usual overview statistics of your model, but most importantly, you will see two tabs titled builds and runs.- Builds: This is where you can see the logs regarding the creation of your environment and the code specified in the Init function. You will see logs only on every deployment.
- Runs: This is where you will see logs concerning every API call to your model endpoint. You can therefore debug every run based on input parameters and the model output.
- Custom Images: How to create your custom environments to run your ML Models.
- Secrets: Use secrets to authenticate with third-party platforms.
- Persistent Storage: Store model weights and files locally for faster access.
- Long Running Tasks: Execute long running tasks in the background.
- Streaming: Stream output live back to your endpoint