How to export module without weights?

Is there any way to export module without weights? Then using the load_module interface load?

I have multi instance of same model, so i tried using share_params to handle duplicates of using of running memory. But I sitll need to export multi share library, so the disk will cost much more?

Thx.

Based on an older version of the relay quick start guide,

I guess you can do something like:

with open(temp.relpath("deploy_graph.json"), "w") as fo:
    fo.write(graph)
with open(temp.relpath("deploy_param.params"), "wb") as fo:
    fo.write(relay.save_param_dict(params))

to save the graph/module and params separately.

Actually, if you use lib.export_library("deploy_lib.tar") to export the library as a tar format, you can find the separated graph and params by unzipping it.

You can also check this doc out for more info.

Hope it helps~

Thx, it works. The module gets smaller.

1 Like