{"record":{"id":"85cea32231303370","repo":"tensorflow/models","slug":"unknown-attention-type","errorCode":null,"errorMessage":"Unknown `attention_type` {}.","messagePattern":"Unknown `attention_type` (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/networks/xlnet_base.py","lineNumber":318,"sourceCode":"      means no clamping.\n    bi_data: bool, whether to use bidirectional input pipeline. Usually set to\n      True during pretraining and False during finetuning.\n    dtype: the dtype of the encoding.\n\n  Returns:\n    A Tensor, representing the position encoding.\n\n  \"\"\"\n  freq_seq = tf.range(0, hidden_size, 2.0)\n  if dtype is not None and dtype != tf.float32:\n    freq_seq = tf.cast(freq_seq, dtype=dtype)\n\n  if attention_type == \"bi\":\n    beg, end = total_length, -seq_length\n  elif attention_type == \"uni\":\n    beg, end = total_length, -1\n  else:\n    raise ValueError(\"Unknown `attention_type` {}.\".format(attention_type))\n\n  if bi_data:\n    forward_position_sequence = tf.range(beg, end, -1.0)\n    backward_position_sequence = tf.range(-beg, -end, 1.0)\n\n    if dtype is not None and dtype != tf.float32:\n      forward_position_sequence = tf.cast(forward_position_sequence,\n                                          dtype=dtype)\n      backward_position_sequence = tf.cast(backward_position_sequence,\n                                           dtype=dtype)\n\n    if clamp_length > 0:\n      forward_position_sequence = tf.clip_by_value(\n          forward_position_sequence,\n          -clamp_length,\n          clamp_length)\n      backward_position_sequence = tf.clip_by_value(\n          backward_position_sequence,","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/networks/xlnet_base.py#L300-L336","documentation":"Error \"Unknown `attention_type` {}.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/networks/xlnet_base.py:318 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"}