b1756fd255d0f921cd30537d55d0dfb2a6c8ad32,auto_ml/utils_models.py,,load_ml_model,#Any#,479

Before Change


def load_ml_model(file_name):
    from keras.models import load_model as keras_load_model

    print("file_name")
    print(file_name)
    with open(file_name, "rb") as read_file:
        base_pipeline = dill.load(read_file)

After Change


    with open(file_name, "rb") as read_file:
        base_pipeline = dill.load(read_file)

    if isinstance(base_pipeline, utils_categorical_ensembling.CategoricalEnsembler):
        for step in base_pipeline.transformation_pipeline.named_steps:
            pipeline_step = base_pipeline.transformation_pipeline.named_steps[step]

            try:
                if pipeline_step.get("model_name", "reallylongnonsensicalstring")[:12] == "DeepLearning":
                    pipeline_step.model = insert_deep_learning_model(pipeline_step, file_name)
            except AttributeError:
                pass

        for step in base_pipeline.trained_models:
            pipeline_step = base_pipeline.trained_models[step]

            try:
                if pipeline_step.get("model_name", "reallylongnonsensicalstring")[:12] == "DeepLearning":
                    pipeline_step.model = insert_deep_learning_model(pipeline_step, file_name)
            except AttributeError:
                pass

    else:

        for step in base_pipeline.named_steps:
            pipeline_step = base_pipeline.named_steps[step]
            try:
                if pipeline_step.get("model_name", "reallylongnonsensicalstring")[:12] == "DeepLearning":
                    pipeline_step.model = insert_deep_learning_model(pipeline_step, file_name)
            except AttributeError:
                pass

    return base_pipeline

    // if isinstance(base_pipeline, utils_categorical_ensembling.CategoricalEnsembler):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: ClimbsRocks/auto_ml
Commit Name: b1756fd255d0f921cd30537d55d0dfb2a6c8ad32
Time: 2017-04-17
Author: ClimbsBytes@gmail.com
File Name: auto_ml/utils_models.py
Class Name:
Method Name: load_ml_model


Project Name: deepmipt/DeepPavlov
Commit Name: 286a864220a00732d382a75051e11877acf13c3f
Time: 2018-01-24
Author: ol.gure@gmail.com
File Name: deeppavlov/core/models/keras_model.py
Class Name: KerasModel
Method Name: load


Project Name: keras-team/autokeras
Commit Name: e70a1e3fddeb24c02ea56f74ff4ce33c8642ac0c
Time: 2018-11-15
Author: jhfjhfj1@gmail.com
File Name: autokeras/utils.py
Class Name:
Method Name: get_device