Closed avan1235 closed 2 years ago
What do you think about the next changes?
data class ModelSummary(
val type: String,
val name: String,
val layersSummaries: List<LayerSummary>,
val trainableParamsCount: Long,
val frozenParamsCount: Long,
val totalParamsCount: Long
)
data class LayerSummary(
val name: String,
val type: String,
val shape: Shape,
val paramsCount: Long,
val inputLayers: List<String>
)
TrainableModel::summary
return ModelSummary
TrainableModel::summary
so it will not have any side effectsModelSummary
to console/loggerHi, @knok16. Give me a few days to think about it; I'll return to you in a couple of days.
Thanks for lighting the problem @avan1235. I totally agree about that the existing solution is not good for notebooks. So great to have a few data classes like @knok16 proposed.
I suppose the proposed solution should contain the following things:
Can I take it?
@knok16 Sure, it's yours
changes for pp 1-3 https://github.com/JetBrains/KotlinDL/pull/216 will do p.4 in separate PR, to not clutter this one
Mostly closed in the #216 I will release an artifact, load it to the Maven Central and make a double check on the Datalore and Jupyter notebooks
I've checked the 0.3.0-alpha-4 artifact, print summary works as expected and this issue has been fixed.
In current implementation the TrainableModel::summary return the list with the descriptions for the following layers.
This information is readable but doesn't allow for easy transformation of model summary gathered data as it is give as raw String. Additionally, the implementation classes log the provided layers description in more readable way, but it is only printed on stdio and not available at least as pretty formatted string that could bu printed later. The problem is more annoying in jupyter notebooks where we don't have an access to stdio and so the logged pretty summary is not visible.
I would propose creating some simple
ModelSummary
data class that would be responsible for holding the model summary data and would have some good implementation oftoString()
method that could be easily printed. It would allow for creating custom printing methods forModelSummary
as well as good keeping of model summary data as a single object instead ofList<String>