Model Summary implementation

Occasionally found the thread for Dev Projects, so I would it would be nice to start a thread here to have one place for discussion.

I will update this thread for the progress.
Information of this feature: https://forums.fast.ai/t/dev-projects-index/29849 (Find PR history in the thread)

Demo:
image
added:

  • model_summary for vision model
  • more information like trainable parameters
  • support for most learner, except Text Learner. (The weight drop layers seems causing some problem for the current implementation)

Working on

Plan for future PR
(items not in order)
add:

  • graph visualization for model structure
  • Backbone, head structure shown in summary

historical discussion:

Usage:

2 Likes

Haven’t figure a nice way to handle Text Model, the function now works for all other learner type except Text, seems that the api is a bit different for SequentialRNN, would love some help.

I am struggling to make it work with Text model. A few issue observed.

  1. Embedding weight is correctly capture, but you can see the hook.stored is None, which suggest it never get executed as the default value should be 0 instead.
  2. LSTM, the weight tensor stored is not called weight, but with some variation like weight_hh_l0, but again the hook.stored is None.
  3. Only Linear layer return expected result.

@jeremy I notice the summary function for the older fastai 0.4 is not implemented for RNN as well, is there some special thing makes it harder to implement? Hope it is ok to @ you for this one.


gist:

1 Like