class_docstr: Constrains an attack to text that has a similar number of linguistically
  accecptable sentences as the original text. Linguistic acceptability is
  determined by a model pre-trained on the `CoLA dataset <https://nyu-
  mll.github.io/CoLA/>`_. By default a BERT model is used, see the `pre-
  trained models README <https://github.com/QData/TextAttack/tree/master/
  textattack/models>`_ for a full list of available models or provide your
  own model from the huggingface model hub.
  
  Args:
      max_diff (float or int): The absolute (if int or greater than or equal to 1) or percent (if float and less than 1)
          maximum difference allowed between the number of valid sentences in the reference
          text and the number of valid sentences in the attacked text.
      model_name (str): The name of the pre-trained model to use for classification. The model must be in huggingface model hub.
      compare_against_original (bool): If `True`, compare against the original text.
          Otherwise, compare against the most recent text.
class_docstr_tok: ["Constrains","an","attack","to","text","that","has","a","similar","number","of","linguistically","accecptable","sentences","as","the","original","text",".","Linguistic","acceptability","is","determined","by","a","model","pre-trained","on","the","`","CoLA","dataset","<","https",":","\/\/nyu-","mll.github.io\/CoLA\/",">","`","_",".","By","default","a","BERT","model","is","used",",","see","the","`","pre-","trained","models","README","<","https",":","\/\/github.com\/QData\/TextAttack\/tree\/master\/","textattack\/models",">","`","_","for","a","full","list","of","available","models","or","provide","your","own","model","from","the","huggingface","model","hub",".","Args",":","max_diff","(","float","or","int",")",":","The","absolute","(","if","int","or","greater","than","or","equal","to","1",")","or","percent","(","if","float","and","less","than","1",")","maximum","difference","allowed","between","the","number","of","valid","sentences","in","the","reference","text","and","the","number","of","valid","sentences","in","the","attacked","text",".","model_name","(","str",")",":","The","name","of","the","pre-trained","model","to","use","for","classification",".","The","model","must","be","in","huggingface","model","hub",".","compare_against_original","(","bool",")",":","If","`","True","`",",","compare","against","the","original","text",".","Otherwise",",","compare","against","the","most","recent","text","."]
code: def __getstate__(self):
      state = self.__dict__.copy()
      state[
          "_reference_score_cache"
      ] = self._reference_score_cache.get_size()
      return state
  
file_path: TextAttack/textattack/constraints/grammaticality/cola.py
imports: import lru
  import nltk
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
  from textattack.constraints import Constraint
  from textattack.models.wrappers import HuggingFaceModelWrapper
label_desc: Use image node_id 5 for calling the COLA obj's underlying member method code with example usage: obj.__getstate__() and returns: state