Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zoltanctoth/b64155a29a62b03e7e8c167903952c4c to your computer and use it in GitHub Desktop.
Save zoltanctoth/b64155a29a62b03e7e8c167903952c4c to your computer and use it in GitHub Desktop.
How to save and load a Native LightGBM Model in Sparlk MLlib
import lightgbm as lgb
# Imagine pipelineModel stages are [x, x, x, trainLightGBMModel]
model.stages[-1].saveNativeModel("/tmp/lightgbm")
nativeLGBModel = lgb.Booster(model_file="/dbfs/tmp/lightgbm/part-00000-tid-5517958219000636906-02c16955-a283-4198-a41a-cdbd78f5aae5-455-1-c000.txt")
mlflow.lightgbm.log_model(nativeLGBModel, artifact_path="lightgbm-model")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment