rwth-i6 / pytorch-to-returnn

Make PyTorch code runnable within RETURNN
3 stars 6 forks source link

allow writing serialized config #109

Closed vieting closed 2 years ago

vieting commented 2 years ago

I added Converter.get_returnn_config_serialized which allows to get a serialized string containing extern_data and the network dict from the Converter. The serialization is copied from returnn_common, there are just two small adjustments regarding Size inputs and floordiv (see separate commit which can be squashed later).

An example usage would be

converter = verify_torch_and_convert_to_returnn(...)
with open(...) as f:
    f.write(converter.get_returnn_config_serialized())