Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit ca90c1a

Browse files
authored
Fix model loading for later versions of XGBoost.
The old method doesn't work for XGBoost versions >= 1.3 https://stackoverflow.com/a/70098541/6179774
1 parent f173a87 commit ca90c1a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc_source/define-pipeline.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ This section shows how to create a processing step to evaluate the accuracy of
417417
with tarfile.open(model_path) as tar:
418418
tar.extractall(path=".")
419419
420-
model = pickle.load(open("xgboost-model", "rb"))
420+
model = xgboost.Booster()
421+
model.load_model("xgboost-model")
421422
422423
test_path = "/opt/ml/processing/test/test.csv"
423424
df = pd.read_csv(test_path, header=None)
@@ -687,4 +688,4 @@ A step can only appear once in either the pipeline's step list or the if/else st
687688

688689
This pipeline definition is ready to submit to SageMaker\. In the next tutorial, you submit this pipeline to SageMaker and start an execution\.
689690

690-
**Next step:** [Run a pipeline](run-pipeline.md)
691+
**Next step:** [Run a pipeline](run-pipeline.md)

0 commit comments

Comments
 (0)