{"record":{"id":"3081d06d590107ee","repo":"tensorflow/models","slug":"when-not-using-a-bias-the-b-init-must-be-none","errorCode":null,"errorMessage":"When not using a bias the b_init must be None.","messagePattern":"When not using a bias the b_init must be None\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/models/t5.py","lineNumber":259,"sourceCode":"  \"\"\"Linear module, optionally including bias.\"\"\"\n\n  def __init__(self,\n               in_features: int,\n               out_features: int,\n               use_bias: bool = True,\n               w_init: Optional[Initializer] = None,\n               b_init: Optional[Initializer] = None,\n               **kwargs):\n    \"\"\"Constructs a `Linear` module.\"\"\"\n    super().__init__(**kwargs)\n    self.in_features = in_features\n    self.out_features = out_features\n    self.use_bias = use_bias\n    self.w_init = w_init\n    if self.use_bias:\n      self.b_init = b_init if b_init else tf_keras.initializers.Zeros()\n    elif b_init is not None:\n      raise ValueError(\"When not using a bias the b_init must be None.\")\n\n    with self.name_scope:\n      if self.w_init is None:\n        stddev = 1 / math.sqrt(self.in_features)\n        self.w_init = tf_keras.initializers.HeNormal()\n\n      self.w = self.create_variable(\n          \"kernel\", [self.in_features, self.out_features],\n          initializer=self.w_init,\n          dtype=self.dtype)\n\n      if self.use_bias:\n        self.b = self.create_variable(\n            \"bias\", [self.out_features],\n            initializer=self.b_init,\n            dtype=self.dtype)\n\n  @tf.Module.with_name_scope","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/models/t5.py#L241-L277","documentation":"Error \"When not using a bias the b_init must be None.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/models/t5.py:259 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"}