{"record":{"id":"4b176c7e974b1a8e","repo":"tensorflow/models","slug":"src-block-size-must-be-specified","errorCode":null,"errorMessage":"src_block_size must be specified.","messagePattern":"src_block_size must be specified\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/layers/block_sparse_attention.py","lineNumber":71,"sourceCode":"  ):\n    \"\"\"Initializes the block sparse attention layer.\n\n    Args:\n      src_block_size: The block size of the query. An integer that divides the\n        sequence length into blocks.\n      tgt_block_size: The block size of the key/value. An integer that divides\n        the sequence length into blocks. The number of blocks in the source and\n        target must be the same.\n      use_sigmoid_attn: If enabled, uses sigmoid instead of softmax to compute\n        attn probs. https://arxiv.org/pdf/2409.04431\n      sigmoid_attn_bias: Bias for sigmoid attn. Suggested value -ln(seq_len).\n      num_kv_heads: Number of key/value heads in the multi-head self attention.\n        Refer to multi_query_attention.py for more details.\n      **kwargs: Args passed to the base class.\n    \"\"\"\n    super().__init__(**kwargs)\n    if src_block_size is None or src_block_size <= 0:\n      raise ValueError(\"src_block_size must be specified.\")\n    self._src_block_size = src_block_size\n    self._tgt_block_size = tgt_block_size or self._src_block_size\n    self._num_kv_heads = num_kv_heads\n    if num_kv_heads is not None and num_kv_heads != 1:\n      raise ValueError(\n          \"num_kv_heads must be 1. Grouped-query attention is not supported.\"\n      )\n    self._use_sigmoid_attn = use_sigmoid_attn\n    self._sigmoid_attn_bias = sigmoid_attn_bias\n    if self._use_sigmoid_attn:\n      if self._sigmoid_attn_bias is None:\n        raise ValueError(\n            \"sigmoid_attn_bias must be specified for sigmoid attn.\"\n        )\n\n  def get_config(self):\n    config = super().get_config()\n    config.update({","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/layers/block_sparse_attention.py#L53-L89","documentation":"Error \"src_block_size must be specified.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/layers/block_sparse_attention.py:71 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"}