(config: PretrainedConfig)
| 782 | |
| 783 | |
| 784 | def get_cross_encoder_activation_function(config: PretrainedConfig): |
| 785 | if (hasattr(config, "sbert_ce_default_activation_function") |
| 786 | and config.sbert_ce_default_activation_function is not None): |
| 787 | |
| 788 | function_name = config.sbert_ce_default_activation_function |
| 789 | assert function_name.startswith("torch.nn.modules."), \ |
| 790 | "Loading of activation functions is restricted to " \ |
| 791 | "torch.nn.modules for security reasons" |
| 792 | return resolve_obj_by_qualname(function_name)() |
| 793 | else: |
| 794 | return nn.Sigmoid() if config.num_labels == 1 else nn.Identity() |
nothing calls this directly
no outgoing calls
no test coverage detected