For a non-Hugging Face model, use the DeepSpeed Activation Checkpointing API.