class_docstr: LM Chunk Teacher, base.
  
  Provides functionality for subclassed teachers for extracting data from world log
  files, generated via `generate_lm_data.py`
class_docstr_tok: ["LM","Chunk","Teacher",",","base",".","Provides","functionality","for","subclassed","teachers","for","extracting","data","from","world","log","files",",","generated","via","`","generate_lm_data.py","`"]
docstr: Separate validation data from training data.
docstr_tok: ["Separate","validation","data","from","training","data","."]
code: def __init__(self, opt: Opt, shared=None) -> None:
      """
      Separate validation data from training data.
      """
      root = opt["root_dir"]
      valid_indices = []
      for s in opt["validation_data_indices"].split(","):
          if s:
              valid_indices.append(int(s))
      if not valid_indices:
          logging.warning(
              "Warning: No validation indices provided, all data will be used for training"
          )
      self.data_files = sorted(
          [f for f in os.listdir(root) if f.endswith(".jsonl")],
          key=lambda x: int(x.replace(".jsonl", "").split("_")[-1]),
      )
      if DatatypeHelper.fold(opt["datatype"]) in ["valid", "test"]:
          self.data_files = [
              d
              for i, d in enumerate(self.data_files)
              if i in valid_indices
          ]
      else:
          self.data_files = [
              d
              for i, d in enumerate(self.data_files)
              if i not in valid_indices
          ]
      opt["datafile"] = root
      super().__init__(opt, shared)
  
imports: from abc import ABC, abstractmethod
  import os
  from typing import Tuple, List, Optional, Any, Dict
  import random
  from parlai.core.message import Message
  from parlai.core.metrics import F1Metric, BleuMetric, RougeMetric, AverageMetric, ExactMatchMetric, normalize_answer
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.teachers import ChunkTeacher, ChunkOutput
  import parlai.tasks.wizard_of_internet.constants
  from parlai.utils.conversations import Conversations
  from parlai.utils.data import DatatypeHelper
  import parlai.utils.logging
  from parlai.tasks.wizard_of_wikipedia.agents import TOKEN_KNOWLEDGE, TOKEN_END_KNOWLEDGE
  from projects.seeker.utils import extract_entities, remove_possible_title_from_text
label_desc: Use image node_id 1 to create a new AbstractLMChunkTeacher object from inherited base classes: ChunkTeacher, ABC with example: obj = AbstractLMChunkTeacher(opt, shared)