Skip to content

How do I Read Things in Python

Allison Brucker (Resources Online) edited this page May 30, 2017 · 4 revisions

This page has migrated to our new site. Please update any bookmarks.

Load model and access network weights (parameters)

Load model and access network weights (parameters)

You have trained and saved a model file. Now you want to load it elsewhere and get the parameters. Here are the steps you need to follow:

    loaded_model = load_model("model_file_path")
    if is_BrainScript: 
        loaded_model = combine([loaded_model.outputs[0]])

    parameters = loaded_model.parameters
    for parameter in parameters:
        print(parameter.name, parameter.shape, "\n", parameter.value) 
Clone this wiki locally