A model’s environment is passed to your Model class as a keyword argument in init. It can be accessed with:

model/model.py
def __init__(self, **kwargs):
    self._environment = kwargs["environment"]

You can then use the self._environment dictionary in the load function:

model/model.py
def load(self):
    # Configure monitoring and weights based on the deployment environment
    if self._environment.get("name") == "production":
        # Production setup
        self.setup_sentry()
        self.setup_logging(level="INFO")
        self.load_production_weights()
    else:
        # Default setup for staging or development deployments
        self.setup_logging(level="DEBUG")
        self.load_default_weights()

Learn more about environments.