[Python] How to Convert 'data.ilearner' Model to 'model.pkl' in Azure ML (Boosted Decision...

Discussão em 'Python' iniciado por Stack, Março 1, 2025.

  1. Stack

    Stack Membro Participativo

    Title: How to Convert 'data.ilearner' to 'model.pkl' in Azure ML (Boosted Decision Tree Regression)?

    Body:

    I created a pipeline in Azure ML that trains a model using Boosted Decision Tree Regression. From my understanding, the model is saved as data.ilearner.

    However, I am unable to convert this model into a model.pkl format that can be loaded using joblib.

    Questions:

    1. How can I create a model.pkl file in Azure ML for a Boosted Decision Tree Regression model?
    2. How can I convert data.ilearner to model.pkl?

    [​IMG]

    Source Code Attempt:


    I attempted to use the following Python script to load and convert the model:

    import lightgbm as lgb
    import joblib

    # Load the LightGBM model
    model = lgb.Booster(model_file="data.ilearner")

    # Save as a Pickle file
    joblib.dump(model, "model.pkl")

    Error Message:


    When running the script, I get the following error:

    % python3 convert_to_model_pkl.py
    [LightGBM] [Fatal] Unknown model format or submodel type in model file data.ilearner
    Traceback (most recent call last):
    File "/Users/tomasz.olchawa/ng/ml/convert_to_model_pkl.py", line 5, in <module>
    model = lgb.Booster(model_file="data.ilearner")
    File "/Users/tomasz.olchawa/ng/ml/myenv/lib/python3.13/site-packages/lightgbm/basic.py", line 3697, in __init__
    _safe_call(
    ~~~~~~~~~~^
    _LIB.LGBM_BoosterCreateFromModelfile(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
    )
    ^
    File "/Users/../ng/ml/myenv/lib/python3.13/site-packages/lightgbm/basic.py", line 313, in _safe_call
    raise LightGBMError(_LIB.LGBM_GetLastError().decode("utf-8"))
    lightgbm.basic.LightGBMError: Unknown model format or submodel type in model file data.ilearner

    Continue reading...

Compartilhe esta Página