Closed emanuelevivoli closed 2 years ago
Hi @apsdehal , I tag you as I saw the m4c commits are mainly from you. Sorry for bothering but I'd like to have some insight on the m4c features behaviour.
Thanks, Emanuele
Tagging @ronghanghu since he actually implemented the code.
Hi @emanuelevivoli, yes, you understood well -- when we removed some features, we still kept their dimensions but set their values to zero. The main benefit of this compared to removing their dimensions is that the model size stays the same, which makes it easier for us to e.g. convert model checkpoints. The downside is that nn.Linear
layers can be larger than what it actually needs to be.
But it should also work well if you change it to directly removing the feature dimensions.
❓ Questions and Help
Hello, I'm new to MMF and its implementation of M4C, and so, I have a doubt. The approach to not using some feature (for example PHOC features for OCR) is that you specify the
remove_ocr_phoc
property ofconfig.ocr
:but you actually calculate all the features in:
and eventually, instead or removing the features, you set them as zeros in:
So my question is: Have I understood well? In case, there are some "issues":
remove_ocr_phoc
orremove_ocr_fasttext
are loaded in any case (when used and when not);configs/models/m4c/defaults.yaml
you will have theconfig.orc.mmt_in_dim
that needs to be the same as you had the PHOC even if you actually don't have it, and that can be prone to error (at least for me);Is there a way (that you can suggest) to change this behaviour? If there is, I could work on it.
Thanks a lot, Emanuele