def encode(self, text, batch_size=32, as_numpy=False):
        """Computes sentence encodings

        Args:
            text: List of documents to encode.
            batch_size: Batch size, defaults to 32.
        """
        df = self.get_hidden_states(text, batch_size)
        pooled = self.pool(df)

        if as_numpy:
            return np.array(pooled["values"].tolist())
        else:
            return pooled
Computes sentence encodings

        Args:
            text: List of documents to encode.
            batch_size: Batch size, defaults to 32.
        
utils_nlp/models/bert/sequence_encoding.py