def __init__(
        self,
        bert_model=None,
        tokenizer=None,
        language=Language.ENGLISH,
        num_gpus=None,
        cache_dir=".",
        to_lower=True,
        max_len=512,
        layer_index=-1,
        pooling_strategy=PoolingStrategy.MEAN,
    ):
        """Initialize the encoder's underlying model and tokenizer

        Args:
            bert_model: BERT model to use for encoding.
                Defaults to pretrained BertModel.
            tokenizer: Tokenizer to use for preprocessing.
                Defaults to pretrained BERT tokenizer.
            language: The pretrained model's language. Defaults to Language.ENGLISH.
            num_gpus: The number of gpus to use. Defaults to None, which forces all
                available GPUs to be used.
            cache_dir: Location of BERT's cache directory. Defaults to "."
            to_lower: True to lowercase before tokenization. Defaults to False.
            max_len: Maximum number of tokens.
            layer_index: The layer from which to extract features.
                         Defaults to the last layer; can also be a list of integers
                         for experimentation.
            pooling_strategy: Pooling strategy to aggregate token embeddings into
                sentence embedding.
        """
        self.model = (
            bert_model.model.bert
            if bert_model
            else BertModel.from_pretrained(language, cache_dir=cache_dir)
        )
        self.tokenizer = (
            tokenizer
            if tokenizer
            else Tokenizer(language, to_lower=to_lower, cache_dir=cache_dir)
        )
        self.num_gpus = num_gpus
        self.max_len = max_len
        self.layer_index = layer_index
        self.pooling_strategy = pooling_strategy
        self.has_cuda = self.cuda
Initialize the encoder's underlying model and tokenizer

        Args:
            bert_model: BERT model to use for encoding.
                Defaults to pretrained BertModel.
            tokenizer: Tokenizer to use for preprocessing.
                Defaults to pretrained BERT tokenizer.
            language: The pretrained model's language. Defaults to Language.ENGLISH.
            num_gpus: The number of gpus to use. Defaults to None, which forces all
                available GPUs to be used.
            cache_dir: Location of BERT's cache directory. Defaults to "."
            to_lower: True to lowercase before tokenization. Defaults to False.
            max_len: Maximum number of tokens.
            layer_index: The layer from which to extract features.
                         Defaults to the last layer; can also be a list of integers
                         for experimentation.
            pooling_strategy: Pooling strategy to aggregate token embeddings into
                sentence embedding.
        
utils_nlp/models/bert/sequence_encoding.py