code: def validate_task(cls, task):
      if task != ModelTask.LANGUAGE_MODEL:
          raise ValueError(
              f"GeneratorLM does not support task {task}."
              f" Tasks supported: {ModelTask.LANGUAGE_MODEL}"
          )
  
imports: import torch
  from torch.nn.functional import log_softmax
  from torch.nn.utils.rnn import pad_sequence
  import codecs
  from time import time
  from math import exp
  from itertools import count, zip_longest
  from copy import deepcopy
  import onmt.model_builder
  import onmt.decoders.ensemble
  from onmt.constants import DefaultTokens
  from onmt.translate.beam_search import BeamSearch, BeamSearchLM
  from onmt.translate.greedy_search import GreedySearch, GreedySearchLM
  from onmt.utils.misc import tile, set_random_seed, report_matrix
  from onmt.utils.alignment import extract_alignment, build_align_pharaoh
  from onmt.modules.copy_generator import collapse_copy_scores
  from onmt.constants import ModelTask
  from onmt.transforms import TransformPipe
label_desc: Use image node_id 1 for calling the GeneratorLM obj's underlying member method code with example usage: obj.validate_task(cls, task) without return types