(
        self,
        name: str,
        get_spans: Callable,
        tokenizer_config: dict = {},
        transformer_config: dict = {},
        mixed_precision: bool = False,
        grad_scaler_config: dict = {},
    )
get_spans (Callable[[List[Doc]], List[Span]]):
            A function to extract spans from the batch of Doc objects.
            This is used to manage long documents, by cutting them into smaller
            sequences before running the transformer. The spans are allowed to
            overlap, and you can also omit sections of the Doc if they are not
            relevant.
        tokenizer_config (dict): Settings to pass to the transformers tokenizer.
        transformer_config (dict): Settings to pass to the transformers forward pass.
get_spans (Callable[[List[Doc]], List[Span]]):
            A function to extract spans from the batch of Doc objects.
            This is used to manage long documents, by cutting them into smaller
            sequences before running the transformer. The spans are allowed to
            overlap, and you can also omit sections of the Doc if they are not
            relevant.
        tokenizer_config (dict): Settings to pass to the transformers tokenizer.
        transformer_config (dict): Settings to pass to the transformers forward pass.
get_spans ( Callable [[ List [ Doc ]] List [ Span ]] ) : A function to extract spans from the batch of Doc objects . This is used to manage long documents by cutting them into smaller sequences before running the transformer . The spans are allowed to overlap and you can also omit sections of the Doc if they are not relevant . tokenizer_config ( dict ) : Settings to pass to the transformers tokenizer . transformer_config ( dict ) : Settings to pass to the transformers forward pass .
def __init__(
        self,
        name: str,
        get_spans: Callable,
        tokenizer_config: dict = {},
        transformer_config: dict = {},
        mixed_precision: bool = False,
        grad_scaler_config: dict = {},
    ):
        """
        get_spans (Callable[[List[Doc]], List[Span]]):
            A function to extract spans from the batch of Doc objects.
            This is used to manage long documents, by cutting them into smaller
            sequences before running the transformer. The spans are allowed to
            overlap, and you can also omit sections of the Doc if they are not
            relevant.
        tokenizer_config (dict): Settings to pass to the transformers tokenizer.
        transformer_config (dict): Settings to pass to the transformers forward pass.
        """
        hf_model = HFObjects(None, None, None, tokenizer_config, transformer_config)
        wrapper = HFWrapper(
            hf_model,
            convert_inputs=_convert_transformer_inputs,
            convert_outputs=_convert_transformer_outputs,
            mixed_precision=mixed_precision,
            grad_scaler_config=grad_scaler_config,
        )
        super().__init__(
            "transformer",
            forward,
            init=init,
            layers=[wrapper],
            dims={"nO": None},
            attrs={
                "get_spans": get_spans,
                "name": name,
                "set_transformer": set_pytorch_transformer,
                "has_transformer": False,
                "flush_cache_chance": 0.0,
                "replace_listener": replace_listener,
                "replace_listener_cfg": replace_listener_cfg,
            },
        )
def __init__ ( self , name : str , get_spans : Callable , tokenizer_config : dict = { } , transformer_config : dict = { } , mixed_precision : bool = False , grad_scaler_config : dict = { } , ) : hf_model = HFObjects ( None , None , None , tokenizer_config , transformer_config ) wrapper = HFWrapper ( hf_model , convert_inputs = _convert_transformer_inputs , convert_outputs = _convert_transformer_outputs , mixed_precision = mixed_precision , grad_scaler_config = grad_scaler_config , ) super ( ) . __init__ ( "transformer" , forward , init = init , layers = [ wrapper ] , dims = { "nO" : None } , attrs = { "get_spans" : get_spans , "name" : name , "set_transformer" : set_pytorch_transformer , "has_transformer" : False , "flush_cache_chance" : 0.0 , "replace_listener" : replace_listener , "replace_listener_cfg" : replace_listener_cfg , } , )