code: def validate_model_gradient_word_swap_compatibility(model):
      """Determines if ``model`` is task-compatible with
      ``GradientBasedWordSwap``.
  
      We can only take the gradient with respect to an individual word if
      the model uses a word-based tokenizer.
      """
      if isinstance(
          model, textattack.models.helpers.LSTMForClassification
      ):
          return True
      else:
          raise ValueError(
              f"Cannot perform GradientBasedWordSwap on model {model}."
          )
  
file_path: TextAttack/textattack/shared/validators.py
imports: import re
  import textattack
  from textattack.goal_functions import InputReduction, MinimizeBleu, NonOverlappingOutput, TargetedClassification, UntargetedClassification
  from .None import logger
label_desc: Use image node_id 2 for calling a global function with example usage: validate_model_gradient_word_swap_compatibility(model) and returns: True