Implementation (Advanced)
Access model environments
A guide to leveraging environments in your models
Model environments help configure behavior based on deployment stage (e.g., production vs. staging). You can access the environment details via kwargs
in the Model
class.
1. Retrieve Environment Variables
Access the environment in __init__
:
2. Configure Behavior Based on Environment
Use environment variables in the load
function:
Why use this?
- Customize logging levels
- Load environment-specific model weights
- Enable monitoring tools (e.g., Sentry)
Was this page helpful?