The reasons is twofold:
a) it´s a better practice than putting the fields and affect them outside a method (e.g., https://github.com/tipeXwins/TFG-LMBugFixing/blob/main/Pipeline/Calls.py#L61)
b) when the module calls is imported in another files, the tokenizers and models are only loaded when the class is instantiated, and there the constructor is invoked.
I created a constructor for the subclasses of HFCommunicationController for example: https://github.com/tipeXwins/TFG-LMBugFixing/pull/8/commits/1fe9a2e968903eedea7284601b4b1c910ababc32#diff-ac0a755fd47439442a92af9baf7e281050607ef0c779de1241422498535de7ecR81
The reasons is twofold: a) it´s a better practice than putting the fields and affect them outside a method (e.g., https://github.com/tipeXwins/TFG-LMBugFixing/blob/main/Pipeline/Calls.py#L61) b) when the module calls is imported in another files, the tokenizers and models are only loaded when the class is instantiated, and there the constructor is invoked.