{"record":{"id":"7211cd45b1fe977f","repo":"tensorflow/models","slug":"unsupported-string-type-s-7211cd","errorCode":null,"errorMessage":"Unsupported string type: %s","messagePattern":"Unsupported string type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"official/nlp/tools/tokenization.py","lineNumber":92,"sourceCode":"  if is_bad_config:\n    raise ValueError(\n        \"You passed in `--do_lower_case=%s` with `--init_checkpoint=%s`. \"\n        \"However, `%s` seems to be a %s model, so you \"\n        \"should pass in `--do_lower_case=%s` so that the fine-tuning matches \"\n        \"how the model was pre-training. If this error is wrong, please \"\n        \"just comment out this check.\" %\n        (actual_flag, init_checkpoint, model_name, case_name, opposite_flag))  # pyrefly: ignore[unbound-name]\n\n\ndef convert_to_unicode(text):\n  \"\"\"Converts `text` to Unicode (if it's not already), assuming utf-8 input.\"\"\"\n  if six.PY3:\n    if isinstance(text, str):\n      return text\n    elif isinstance(text, bytes):\n      return text.decode(\"utf-8\", \"ignore\")\n    else:\n      raise ValueError(\"Unsupported string type: %s\" % (type(text)))\n  elif six.PY2:\n    if isinstance(text, str):\n      return text.decode(\"utf-8\", \"ignore\")  # pyrefly: ignore[missing-attribute]\n    elif isinstance(text, unicode):  # pyrefly: ignore[unknown-name]\n      return text\n    else:\n      raise ValueError(\"Unsupported string type: %s\" % (type(text)))\n  else:\n    raise ValueError(\"Not running on Python2 or Python 3?\")\n\n\ndef printable_text(text):\n  \"\"\"Returns text encoded in a way suitable for print or `tf.logging`.\"\"\"\n\n  # These functions want `str` for both Python2 and Python3, but in one case\n  # it's a Unicode string and in the other it's a byte string.\n  if six.PY3:\n    if isinstance(text, str):","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/tools/tokenization.py#L74-L110","documentation":"Error \"Unsupported string type: %s\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/tools/tokenization.py:92 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"}