How to convert non nn.module based code into nn.module based code in pytorch?

hi @ptrblck
i am trying to use this one : TextFuseNet/roi_heads.py at master · ying09/TextFuseNet · GitHub

into this one : detectron2/roi_heads.py at master · facebookresearch/detectron2 · GitHub

you can see the latest version of detectron2 is written with lot of nn.module based code

the init function in my first link attached above is different than the 2nd link’s function,i am not understanding how do i pass cfg there?
i tried code conversion like this : det - Pastebin.com
but i get this error :

roi_heads.py", line 593, in init
self.mutil_path_fuse_on = cfg.MODEL.TEXTFUSENET_MUTIL_PATH_FUSE_ON
NameError: name ‘cfg’ is not defined