MCPcopy Create free account
hub / github.com/bruno686/VisPlay / get_cross_encoder_activation_function

Function get_cross_encoder_activation_function

config.py:784–794  ·  view source on GitHub ↗
(config: PretrainedConfig)

Source from the content-addressed store, hash-verified

782
783
784def 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()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected