Skip to content

Keras Save Model

Overview

Compatible Pyspark only

Python node : launch with punchplatform-pyspark.sh or the punch UI job-editor with environment pyspark.

This node take as input stream a keras model, and saves it to the local file system.

It takes only one setting : - path : the full path to the desired save location (include the model file name), for example /punch/my_model.h5 will save the model under /punch with name my_model.

This node create parents folder to the save destination if they don't already exist.

Example configuration :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
        {
            type: keras_save_model
            component: model_save
            settings:{
                path: my_model.h5
            },
            subscribe:[
                {
                    component: trainer
                    stream: model
                }
            ]
        }

Example of complete pipeline :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  type: pyspark
  job: [ 
        {
            type: keras_train
            component: trainer
            publish: [
                {
                    stream: model
                },
            ]
        }
        {
            type: keras_save_model
            component: model_save
            settings:{
                path: my_model.h5
            },
            subscribe:[
                {
                    component: trainer
                    stream: model
                }
            ]
        }
    ]
}