class_docstr: Each `Instance` in a `Scenario` looks like this:
  
      <input> -> <reference1>
                 <reference2>
                 <reference3> [correct]
                 <reference4>
  
  For language modeling, we don't use the references (even if they exist), just feed the input:
  
      <input>
docstr: Adapted from https://github.com/EleutherAI/lm_perplexity/blob/main/lm_perplexity/utils.py.
docstr_tok: ["Adapted","from","https",":","\/\/github.com\/EleutherAI\/lm_perplexity\/blob\/main\/lm_perplexity\/utils.py","."]
code: def generate_requests(
      self, eval_instance: Instance
  ) -> List[RequestState]:
      """
      Adapted from https://github.com/EleutherAI/lm_perplexity/blob/main/lm_perplexity/utils.py.
      """
      max_sequence_length: int = self.window_service.max_sequence_length
      max_request_length: int = self.window_service.max_request_length
      prefix_token: str = self.window_service.prefix_token
  
      encode_result: EncodeResult = self.window_service.encode(
          eval_instance.input.text
      )
      tokens: List[TokenizationToken] = encode_result.tokens
      text: str = encode_result.text
  
      request_states: List[RequestState] = []
      num_predicted_tokens: int = 0
  
      # Special handling for first window: predict all tokens
      # Example for GPT-3:
      # Raw token sequence format: [<str_tok1>, <str_tok2>, ..., <byte_tok1>, ...]
      # (total length <= max_sequence_length)
      # Convert it to: [<eot>, <str_tok1>, <str_tok2>, ...]
      # (total length <= max_req_len = max_sequence_length+1 for GPT-3)
      # Num_conditioning_tokens = 1
      # Example: ["Hello", " world", "bytes:\xe2\x80"] => "<eot>Hello world"
      #
      # Note: There are trailing byte tokens in the raw sequence because some subwords/symbols might translate to
      # multiple tokens (e.g. ’ => ["bytes:\xe2\x80", "bytes:\x99"]) and we chunk documents by token, not by word.
  
      # Uses `max_sequence_length` instead of `max_request_length` here because `prefix_token` will be prepended
      # to the sequence later. This is the only place where `max_sequence_length` is used.
      first_seq_len: int = min(max_sequence_length, len(tokens))
      (
          prompt_text,
          num_conditioning_tokens,
      ) = self.construct_language_modeling_prompt(
          self.window_service.encode(prefix_token).tokens,
          tokens[:first_seq_len],
          max_request_length,
          text,
      )
      request = Request(
          model=self.adapter_spec.model,
          prompt=prompt_text,
          num_completions=1,
          temperature=0,
          max_tokens=self.adapter_spec.max_tokens,  # usually this is zero
          stop_sequences=self.adapter_spec.stop_sequences,
          echo_prompt=True,
          random=self.adapter_spec.random,
      )
      request_state = RequestState(
          instance=eval_instance,
          reference_index=None,
          request_mode=None,
          train_trial_index=0,
          output_mapping=None,
          request=request,
          result=None,
          num_conditioning_tokens=1 if len(prefix_token) > 0 else 0,
          num_train_instances=self.adapter_spec.max_train_instances,
          prompt_truncated=False,
      )
      request_states.append(request_state)
      num_predicted_tokens += first_seq_len
  
      while num_predicted_tokens < len(tokens):
          # Example for GPT-3:
          # Raw token sequence format:
          # [<cond_byte1>, ..., <cond_str_tok1>, <cond_str_tok2>, ..., <pred_str_tok1>, ..., <pred_byte1>, ...]
          # (total length <= max_req_len = max_sequence_length+1 for GPT-3)
          #
          # Convert it to: [<cond_str_tok1>, <cond_str_tok2>, ..., <pred_str_tok1>, <pred_str_tok2>. ...]
          # (total length <= max_req_len = max_sequence_length+1 for GPT-3)
          #
          # Example: conditioning_tokens=["bytes:\x99", "Exc"], pred_tokens=["use", " me", "bytes:\xe2\x80"] =>
          # prompt="Excuse me", num_conditioning_tokens = 1
  
          # The upper bound is `max_req_len - 1` because there will be at least 1 conditioning tokens.
          window_pred_len: int = min(
              len(tokens) - num_predicted_tokens, max_request_length - 1
          )
          window_end: int = num_predicted_tokens + window_pred_len
          conditioning_tokens: List[TokenizationToken] = tokens[
              window_end - max_request_length : num_predicted_tokens
          ]
          pred_tokens: List[TokenizationToken] = tokens[
              num_predicted_tokens:window_end
          ]
          (
              prompt_text,
              num_conditioning_tokens,
          ) = self.construct_language_modeling_prompt(
              conditioning_tokens, pred_tokens, max_request_length, text
          )
  
          request = Request(
              model=self.adapter_spec.model,
              prompt=prompt_text,
              num_completions=1,
              temperature=0,
              max_tokens=self.adapter_spec.max_tokens,  # usually this is zero
              stop_sequences=self.adapter_spec.stop_sequences,
              echo_prompt=True,
          )
          request_state = RequestState(
              instance=eval_instance,
              reference_index=None,
              request_mode=None,
              train_trial_index=0,
              output_mapping=None,
              request=request,
              result=None,
              num_conditioning_tokens=num_conditioning_tokens,
              num_train_instances=self.adapter_spec.max_train_instances,
              prompt_truncated=False,
          )
          request_states.append(request_state)
          num_predicted_tokens += window_pred_len
  
      return request_states
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/adaptation/adapters/language_modeling_adapter.py
imports: from typing import List, Tuple, Optional
  from helm.benchmark.adaptation.request_state import RequestState
  from helm.benchmark.adaptation.scenario_state import ScenarioState
  from helm.benchmark.scenarios.scenario import Instance, EVAL_SPLITS
  from helm.benchmark.window_services.window_service import EncodeResult
  from helm.common.general import flatten_list, parallel_map
  from helm.common.hierarchical_logger import hlog, htrack
  from helm.common.request import Request
  from helm.common.tokenization_request import TokenizationToken
  from .adapter import Adapter
label_desc: Use image node_id 2 for calling the LanguageModelingAdapter obj's underlying member method code with example usage: obj.generate_requests(eval_instance) and returns: request_states