Hi @sru
By default, all models now return output as a dict, but your code expecting a tuple which is the reason for above error. You could access the hidden_states in the returned object. See the docs for model output classes
https://huggingface.co/transformers/main_classes/output.html 34
Also, XLNetModel does return pooled output, you would need to do the pooling yourself, or you can just use XLNetForSequenceClassification, which does the pooling and passes that pooled output through a classification head. You could refer to how XLNetForSequenceClassification is implemented.
  
      github.com
  
  
    huggingface/transformers/blob/c6d5e56595c0c0134c744f9e38ab2dedb6707388/src/transformers/models/xlnet/modeling_xlnet.py#L1482 5

        return [layer_past.index_select(1, beam_idx.to(layer_past.device)) for layer_past in mems]@add_start_docstrings(    """    XLNet Model with a sequence classification/regression head on top (a linear layer on top of the pooled output) e.g.    for GLUE tasks.    """,    XLNET_START_DOCSTRING,)class XLNetForSequenceClassification(XLNetPreTrainedModel):    def __init__(self, config):        super().__init__(config)        self.num_labels = config.num_labels        self.transformer = XLNetModel(config)        self.sequence_summary = SequenceSummary(config)        self.logits_proj = nn.Linear(config.d_model, config.num_labels)        self.init_weights()