Hey @iakarshu my best guess is that the authors implemented DocFormer from scratch, so as far as I can tell you can’t do some clever subclassing of an existing model to tweak the attention layers.
Having said that, you could look at the implementation of LayoutLMV2 4 which seems to share a similar approach and you can use this template 4 to get all the basic modeling files.
Do you know if AWS open-sourced the pretrained weights of DocFormer? Without them, you might need a lot of compute to build a useful model.
Hope that helps!