class_docstr: Dataset for Causal Language modeling.
code: def get_labels(self, prompt_encodings, answer_encodings):
      labels = torch.cat(
          [
              torch.cat([prompt_encoding, answer_encoding])
              for prompt_encoding, answer_encoding in zip(
                  prompt_encodings, answer_encodings
              )
          ]
      ).clone()
  
      if self.cfg.dataset.mask_prompt_labels:
          prompt_mask = torch.cat(
              [
                  torch.cat(
                      [
                          torch.ones_like(prompt_encoding),
                          torch.zeros_like(answer_encoding),
                      ]
                  )
                  for prompt_encoding, answer_encoding in zip(
                      prompt_encodings, answer_encodings
                  )
              ]
          ).to(torch.bool)
          labels.masked_fill_(prompt_mask, -100)
      if self.cfg.dataset.add_eos_token_to_answer:
          # eos_token may be equal to pad_token. Add the label back manually.
          labels[-1] = self.tokenizer.eos_token_id
      if self.cfg.tokenizer.max_length < len(labels):
          labels = labels[-self.cfg.tokenizer.max_length :]
  
      sample = dict(
          labels=torch.full((self.cfg.tokenizer.max_length,), -100)
      )
      sample["labels"][-len(labels) :] = labels
      return sample
  
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 15 for calling the CustomDataset obj's underlying member method code with example usage: obj.get_labels(prompt_encodings, answer_encodings) and returns: sample