class_docstr: Dataset for Causal Language modeling.
code: def encode(
      tokenizer, text: str, max_length: int, truncation_side: str
  ) -> Dict:
      encodings = tokenizer(
          text, return_tensors="pt", add_special_tokens=False
      )
      encodings["input_ids"] = encodings["input_ids"][0]
      encodings["attention_mask"] = encodings["attention_mask"][0]
      if truncation_side == "right":
          encodings["input_ids"] = encodings["input_ids"][:max_length]
          encodings["attention_mask"] = encodings["attention_mask"][
              :max_length
          ]
      else:
          encodings["input_ids"] = encodings["input_ids"][-max_length:]
          encodings["attention_mask"] = encodings["attention_mask"][
              -max_length:
          ]
      return encodings
  
imports: import codecs
  import collections.abc
  import logging
  from typing import Any, Dict, List, Tuple, Union
  import numpy
  import pandas
  import torch
  from torch.utils.data import Dataset
  from llm_studio.src.datasets.conversation_chain_handler import ConversationChainHandler
  from llm_studio.src.datasets.text_utils import get_tokenizer
label_desc: Use image node_id 20 for calling the CustomDataset obj's underlying member method code with example usage: obj.encode(tokenizer, text, max_length, truncation_side) and returns: encodings