TabularPredictor.delete_models¶
- TabularPredictor.delete_models(models_to_keep: str | list[str] | None = None, models_to_delete: str | list[str] | None = None, allow_delete_cascade: bool = False, delete_from_disk: bool = True, dry_run: bool | None = None)[source]¶
Deletes models from predictor. This can be helpful to minimize memory usage and disk usage, particularly for model deployment. This will remove all references to the models in predictor.
For example, removed models will not appear in predictor.leaderboard().
- WARNING: If delete_from_disk=True, this will DELETE ALL FILES in the deleted model directories, regardless if they were created by AutoGluon or not.
DO NOT STORE FILES INSIDE OF THE MODEL DIRECTORY THAT ARE UNRELATED TO AUTOGLUON.
- Parameters:
models_to_keep (str or list[str], default = None) – Name of model or models to not delete. All models that are not specified and are also not required as a dependency of any model in models_to_keep will be deleted. Specify models_to_keep=’best’ to keep only the best model and its model dependencies. models_to_delete must be None if models_to_keep is set. To see the list of possible model names, use: predictor.model_names() or predictor.leaderboard().
models_to_delete (str or list[str], default = None) – Name of model or models to delete. All models that are not specified but depend on a model in models_to_delete will also be deleted. models_to_keep must be None if models_to_delete is set.
allow_delete_cascade (bool, default = False) –
- If False, if unspecified dependent models of models in models_to_delete exist an exception will be raised instead of deletion occurring.
An example of a dependent model is m1 if m2 is a stacker model and takes predictions from m1 as inputs. In this case, m1 would be a dependent model of m2.
If True, all dependent models of models in models_to_delete will be deleted. Has no effect if models_to_delete=None.
delete_from_disk (bool, default = True) –
If True, deletes the models from disk if they were persisted. WARNING: This deletes the entire directory for the deleted models, and ALL FILES located there.
It is highly recommended to first run with dry_run=True to understand which directories will be deleted.
dry_run (bool, default = True) – WARNING: Starting in v1.4.0 dry_run will default to False. If True, then deletions don’t occur, and logging statements are printed describing what would have occurred. Set dry_run=False to perform the deletions.