quantlab.model.predefined.xgb.boosters_on_cpu#

quantlab.model.predefined.xgb.boosters_on_cpu(boosters, device)[source]#

Put boosters on device="cpu" for the block, then back on device.

Used to write a checkpoint that loads on a machine without CUDA while the Boosters in memory keep their device. device=None leaves them on the CPU.

Examples

>>> with boosters_on_cpu([booster], "cuda"):
...     joblib.dump(booster, "model.joblib")