code: def text_to_tokens_mask(self, X, Y=None, context=None):
      out_gen = self._text_to_ids(X, pad_token=self.config.pad_token)
      for i, out in enumerate(out_gen):
          if context is None:
              feats = {"tokens": out.token_ids}
          else:
              out_forward = EncodedOutput(
                  token_ids=out.token_ids[0],
                  tokens=out.token_ids[0],
                  token_ends=out.token_ends,
                  token_starts=out.token_starts,
              )
              out_backward = EncodedOutput(
                  token_ids=out.token_ids[1],
                  tokens=out.token_ids[1],
                  token_ends=out.token_ends,
                  token_starts=out.token_starts,
              )
              tokenized_context_forward = tokenize_context(
                  context[0], out_forward, self.config
              )
              tokenized_context_backward = tokenize_context(
                  context[1], out_backward, self.config
              )
              tokenized_context = [
                  tokenized_context_forward,
                  tokenized_context_backward,
              ]
              feats = {
                  "tokens": out.token_ids,
                  "context": tokenized_context,
              }
          if Y is None:
              yield feats
          else:
              yield feats, self.label_encoder.transform([Y])[0]
  
imports: import numpy
  import tensorflow
  import copy
  from finetune.errors import FinetuneError
  from finetune.base import BaseModel
  from finetune.target_models.classifier import Classifier, ClassificationPipeline
  from finetune.encoding.input_encoder import EncodedOutput, tokenize_context
label_desc: Use image node_id 3 for calling the ComparisonPipeline obj's underlying member method code with example usage: obj.text_to_tokens_mask(X, Y, context) without return types