singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [singa] joddiy commented on issue #691: Add save and load method for Module class
Date Sat, 16 May 2020 08:37:11 GMT

joddiy commented on issue #691:
URL: https://github.com/apache/singa/issues/691#issuecomment-629610072


   > To be consistent, I think we'd better always call `m.compile()` explicitly?
   > 
   > ```python
   > m=MyModel()
   > m.compile([x], use_graph=True)
   > m.load_states(fpath)
   > 
   > m=MyONNXModel(onnx_model)
   > m.compile([x], use_graph=True)
   > 
   > m=singa.load(fpath)
   > m.compile([x], use_graph=True)
   > ```
   > 
   > Then the `load_states()` only has a single argument, i.e., fpath.
   > 
   > Any better solution?
   
   Actually, in the above sonnx API, we merge load_states into compile, right?
   How about this one:
   
   ```
   m=MyModel(path) # check the file is a model or just states
   m.compile([x], use_graph=True) # do m.load_states(fpath) within compile
   
   m=MyONNXModel(onnx_model)
   m.compile([x], use_graph=True)
   
   m=singa.load(fpath)
   m.compile([x], use_graph=True)
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message