code: def featurize(self, tokenizer, feat_spec):
      # Handle masked_tokens
      unpadded_masked_inputs = (
          construct_single_input_tokens_and_segment_ids(
              input_tokens=self.masked_tokens,
              tokenizer=tokenizer,
              feat_spec=feat_spec,
          )
      )
      masked_input_set = create_input_set_from_tokens_and_segments(
          unpadded_tokens=unpadded_masked_inputs.unpadded_tokens,
          unpadded_segment_ids=unpadded_masked_inputs.unpadded_segment_ids,
          tokenizer=tokenizer,
          feat_spec=feat_spec,
      )
      # Handle label_tokens
      special_tokens_count = 2  # CLS, SEP
      pad_token = tokenizer.pad_token
      (unpadded_label_tokens,) = truncate_sequences(
          tokens_ls=[self.label_tokens],
          max_length=feat_spec.max_seq_length - special_tokens_count,
      )
      if feat_spec.cls_token_at_end:
          unpadded_label_tokens = unpadded_label_tokens + [
              pad_token,
              pad_token,
          ]
      else:
          unpadded_label_tokens = (
              [pad_token] + unpadded_label_tokens + [pad_token]
          )
      unpadded_label_token_ids = tokenizer.convert_tokens_to_ids(
          unpadded_label_tokens
      )
      masked_lm_labels = pad_single_with_feat_spec(
          ls=unpadded_label_token_ids,
          feat_spec=feat_spec,
          pad_idx=feat_spec.pad_token_id,
      )
      masked_lm_labels = np.array(masked_lm_labels)
      masked_lm_labels[
          masked_lm_labels == feat_spec.pad_token_id
      ] = mlm_template.NON_MASKED_TOKEN_LABEL_ID
      return DataRow(
          guid=self.guid,
          masked_input_ids=np.array(masked_input_set.input_ids),
          input_mask=np.array(masked_input_set.input_mask),
          segment_ids=np.array(masked_input_set.segment_ids),
          masked_lm_labels=masked_lm_labels,
          masked_tokens=unpadded_masked_inputs.unpadded_tokens,
          label_tokens=unpadded_label_tokens,
      )
  
file_path: jiant/jiant/tasks/lib/templates/mlm_premasked.py
imports: import numpy
  import torch
  from dataclasses import dataclass
  from typing import List
  from jiant.tasks.lib.templates import mlm
  from jiant.tasks.core import BaseExample, BaseTokenizedExample, BaseDataRow, BatchMixin
  from jiant.tasks.utils import ExclusiveSpan, truncate_sequences
  from jiant.tasks.lib.templates.shared import construct_single_input_tokens_and_segment_ids, create_input_set_from_tokens_and_segments, pad_single_with_feat_spec
label_desc: Use image node_id 1 for calling the TokenizedExample obj's underlying member method code with example usage: obj.featurize(tokenizer, feat_spec) and returns: DataRow