{"record":{"id":"d6a9b73b5702014d","repo":"tensorflow/models","slug":"unsupported-attention-type","errorCode":null,"errorMessage":"Unsupported attention type: {}","messagePattern":"Unsupported attention type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/xlnet/xlnet_modeling.py","lineNumber":583,"sourceCode":"    new_mems = []\n\n    bsz = tf.shape(inp_k)[1]\n\n    qlen = inp_k.shape.as_list()[0]\n\n    mlen = mems[0].shape.as_list()[0] if mems is not None else 0\n    klen = mlen + qlen\n\n    ##### Attention mask\n    # causal attention mask\n    if self.attn_type == \"uni\":\n      attn_mask = _create_mask(qlen, mlen, self.tf_float, self.same_length)\n      # pylint: enable=protected-access\n      attn_mask = attn_mask[:, :, None, None]\n    elif self.attn_type == \"bi\":\n      attn_mask = None\n    else:\n      raise ValueError(\"Unsupported attention type: {}\".format(self.attn_type))\n\n    # data mask: input mask & perm mask\n    if input_mask is not None and perm_mask is not None:\n      data_mask = input_mask[None] + perm_mask\n\n    elif input_mask is not None and perm_mask is None:\n      data_mask = input_mask[None]\n    elif input_mask is None and perm_mask is not None:\n      data_mask = perm_mask\n    else:\n      data_mask = None\n\n    if data_mask is not None:\n      # all mems can be attended to\n      mems_mask = tf.zeros([tf.shape(data_mask)[0], mlen, bsz],\n                           dtype=self.tf_float)\n      data_mask = tf.concat([mems_mask, data_mask], 1)\n      if attn_mask is None:","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/xlnet/xlnet_modeling.py#L565-L601","documentation":"Error \"Unsupported attention type: {}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/xlnet/xlnet_modeling.py:583 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}