class_docstr: Yelp MD Gender Teacher.
docstr: Load data from the checkpoint.
docstr_tok: ["Load","data","from","the","checkpoint","."]
code: def _load_gender_data(self, datatype):
      """
      Load data from the checkpoint.
      """
      dt = datatype.split(":")[0]
      data = []
      folder = self.data_path
      if dt == "train":
          gender_cnt = {gend_utils.MASC: 0, gend_utils.FEM: 0}
          fle = os.path.join(folder, "classtrain.txt")
          with open(fle, "r") as f:
              lines = f.read().splitlines()
              for line in lines:
                  gender, text = line.split("\t")
                  data.append(
                      {
                          "text": text,
                          "labels": [f"SELF:{gender}"],
                          "class_type": "self",
                      }
                  )
                  gender_cnt[gender] += 1
          print("Trainset gender cnts:\n" + "=" * 50)
          tot = sum(gender_cnt.values())
          for k, v in gender_cnt.items():
              print(f"{k}: {v} ({v / tot})")
          print(f"TOTAL: {tot}")
      else:
          if dt == "valid":
              dt = "dev"
          # female data
          female_fle = os.path.join(folder, f"female_only.{dt}.en")
          # male data
          male_fle = os.path.join(folder, f"male_only.{dt}.en")
          with open(female_fle, "r") as f:
              with open(male_fle, "r") as m:
                  f_lines = f.read().splitlines()
                  m_lines = m.read().splitlines()
              for f_line, m_line in zip(f_lines, m_lines):
                  # alternate this
                  data.append(
                      {
                          "text": f_line,
                          "labels": [f"SELF:{gend_utils.FEM}"],
                          "class_type": "self",
                      }
                  )
                  data.append(
                      {
                          "text": m_line,
                          "labels": [f"SELF:{gend_utils.MASC}"],
                          "class_type": "self",
                      }
                  )
  
      return data
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.core.teachers import FixedDialogTeacher
  from parlai.utils.io import PathManager
  import parlai.tasks.md_gender.utils
  import parlai.utils.logging
  from copy import deepcopy
  import os
  import random
  import sys
label_desc: Use image node_id 4 for calling the YelpTeacher obj's underlying member method code with example usage: obj._load_gender_data(datatype) and returns: data