Args: model (TYPE): NULL optimzer (TYPE): NULL save_path (TYPE): NULL Returns: TODO Raises: NULL
(model, optimzer, save_path)
| 51 | |
| 52 | |
| 53 | def save(model, optimzer, save_path): |
| 54 | """ |
| 55 | |
| 56 | Args: |
| 57 | model (TYPE): NULL |
| 58 | optimzer (TYPE): NULL |
| 59 | save_path (TYPE): NULL |
| 60 | |
| 61 | Returns: TODO |
| 62 | |
| 63 | Raises: NULL |
| 64 | """ |
| 65 | try: |
| 66 | paddle.save(model.state_dict(), save_path + '.pdparams') |
| 67 | paddle.save(optimzer.state_dict(), save_path + '.pdopt') |
| 68 | except Exception as e: |
| 69 | logging.error('save model and optimzer failed. save path: %s', save_path) |
| 70 | logging.error(traceback.format_exc()) |
| 71 | |
| 72 | |
| 73 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected