class_docstr: Tokenizing strategy for Pygmalion.
class_docstr_tok: ["Tokenizing","strategy","for","Pygmalion","."]
code: def tokenize_prompt(self, prompt):
      result, current_len = tokenize_prompt_default()
      for _, part in enumerate(
          self.prompter.build_prompt(prompt["conversations"])
      ):
          role, message = part
          if role == "system":
              prefix = "<|system|>"
              # this should include a bos token, no eos token, strip trailing "\n<START>"
              if message.endswith("\n<START>"):
                  message = message[:-8]
              res = self._tokenize(
                  prefix + "Persona: " + message.strip(),
                  add_eos_token=False,
                  strip_bos_token=False,
              )
              # everything from this is masked out from the labels
              labels = [IGNORE_TOKEN_ID] * len(res["input_ids"])
          elif role == "human":
              prefix = "<|user|>"
              res = self._tokenize(
                  prefix + " " + message.strip(),
                  add_eos_token=False,
                  strip_bos_token=True,
              )
              # everything from this is masked out from the labels
              labels = [IGNORE_TOKEN_ID] * len(res["input_ids"])
          elif role == "bot":
              prefix = "<|model|>"
              res = self._tokenize(
                  prefix + " " + message.strip(),
                  add_eos_token=True,
                  strip_bos_token=True,
              )
              # mask out the prefix token, rest is not masked out from labels
              # make sure we create the labels first, otherwise we get incorrect lengths
              labels = [IGNORE_TOKEN_ID] * len(
                  self.bot_prefix_token_ids
              ) + [*copy.deepcopy(res["input_ids"])][
                  len(self.bot_prefix_token_ids) :
              ]
          else:
              LOG.warning(f"unknown role in conversation: {role}")
              res = defaultdict(lambda: [])
  
          # pylint: disable=duplicate-code
          result, current_len = parse_tokenized_to_result(
              result,
              current_len,
              res,
              labels,
              pad_token_id=self.tokenizer.pad_token_id,
          )
      return result
  
file_path: axolotl/src/axolotl/prompt_strategies/pygmalion.py
imports: import copy
  import logging
  from collections import defaultdict
  from typing import Generator, List, Tuple
  from axolotl.prompt_tokenizers import PromptTokenizingStrategy, parse_tokenized_to_result, tokenize_prompt_default
label_desc: Use image node_id 2 for calling the PygmalionPromptTokenizingStrategy obj's underlying member method code with example usage: obj.tokenize_prompt(prompt) and returns: result