keras modelcheckpoint的适配器回调,允许检查替代模型(通常是多gpu模型的子模型)。
alt-model-checkpoint的Python项目详细描述
alt模型检查点
kerasModelCheckpoint的适配器回调,允许检查点 替代模型(通常是多GPU模型的子模型)。
安装
pip install alt-model-checkpoint
用法
您必须提供自己的keras或tensorflow安装。有关首选版本,请参见Pipfile
。
如果使用TensorFlow中捆绑的路缘石:
fromalt_model_checkpoint.tensorflowimportAltModelCheckpoint
如果使用Keras独立版:
fromalt_model_checkpoint.kerasimportAltModelCheckpoint
涉及使用keras构建的多gpu模型的常见用法multi_gpu_model()
:
fromalt_model_checkpoint.kerasimportAltModelCheckpointfromkeras.modelsimportModelfromkeras.utilsimportmulti_gpu_modelbase_model=Model(...)gpu_model=multi_gpu_model(base_model)gpu_model.compile(...)gpu_model.fit(...,callbacks=[AltModelCheckpoint('save/path/for/model.hdf5',base_model)])
开发环境设置
- 安装pipenv。
- 运行
make test
(自动运行make test-build
以确保DEPS)