{"record":{"id":"9b0c345f6731a25c","repo":"tensorflow/models","slug":"unknown-output-value-s-output-can-be-eithe-9b0c34","errorCode":null,"errorMessage":"Unknown `output` value \"%s\". `output` can be either \"logits\" or \"predictions\"","messagePattern":"Unknown `output` value \"(.+?)\"\\. `output` can be either \"logits\" or \"predictions\"","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/models/bert_token_classifier.py","lineNumber":87,"sourceCode":"    else:\n      sequence_output = outputs['sequence_output']\n    sequence_output = tf_keras.layers.Dropout(rate=dropout_rate)(\n        sequence_output)\n\n    classifier = tf_keras.layers.Dense(\n        num_classes,\n        activation=None,\n        kernel_initializer=initializer,\n        name='predictions/transform/logits')\n    logits = classifier(sequence_output)\n    if output == 'logits':\n      output_tensors = {'logits': logits}\n    elif output == 'predictions':\n      output_tensors = {\n          'predictions': tf_keras.layers.Activation(tf.nn.log_softmax)(logits)\n      }\n    else:\n      raise ValueError(\n          ('Unknown `output` value \"%s\". `output` can be either \"logits\" or '\n           '\"predictions\"') % output)\n\n    if output_encoder_outputs:\n      output_tensors['encoder_outputs'] = sequence_output\n\n    # b/164516224\n    # Once we've created the network using the Functional API, we call\n    # super().__init__ as though we were invoking the Functional API Model\n    # constructor, resulting in this object having all the properties of a model\n    # created using the Functional API. Once super().__init__ is called, we\n    # can assign attributes to `self` - note that all `self` assignments are\n    # below this line.\n    super(BertTokenClassifier, self).__init__(\n        inputs=inputs, outputs=output_tensors, **kwargs)\n\n    self._network = network\n    config_dict = {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/models/bert_token_classifier.py#L69-L105","documentation":"Error \"Unknown `output` value \"%s\". `output` can be either \"logits\" or \"predictions\"\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/models/bert_token_classifier.py:87 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"}