{"record":{"id":"16f180f270d11aa3","repo":"tensorflow/models","slug":"unrecognized-distribution-strategy-r","errorCode":null,"errorMessage":"Unrecognized Distribution Strategy: %r","messagePattern":"Unrecognized Distribution Strategy: %r","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/common/distribute_utils.py","lineNumber":203,"sourceCode":"    if num_gpus > 1:\n      raise ValueError(\"`OneDeviceStrategy` can not be used for more than \"\n                       \"one device.\")\n    return tf.distribute.OneDeviceStrategy(\"device:GPU:0\")\n\n  if distribution_strategy == \"mirrored\":\n    if num_gpus == 0:\n      devices = [\"device:CPU:0\"]\n    else:\n      devices = [\"device:GPU:%d\" % i for i in range(num_gpus)]\n    return tf.distribute.MirroredStrategy(\n        devices=devices,\n        cross_device_ops=_mirrored_cross_device_ops(all_reduce_alg, num_packs))\n\n  if distribution_strategy == \"parameter_server\":\n    cluster_resolver = tf.distribute.cluster_resolver.TFConfigClusterResolver()\n    return tf.distribute.experimental.ParameterServerStrategy(cluster_resolver)\n\n  raise ValueError(\"Unrecognized Distribution Strategy: %r\" %\n                   distribution_strategy)\n\n\ndef configure_cluster(worker_hosts=None, task_index=-1):\n  \"\"\"Set multi-worker cluster spec in TF_CONFIG environment variable.\n\n  Args:\n    worker_hosts: comma-separated list of worker ip:port pairs.\n    task_index: index of the worker.\n\n  Returns:\n    Number of workers in the cluster.\n  \"\"\"\n  tf_config = json.loads(os.environ.get(\"TF_CONFIG\", \"{}\"))\n  if tf_config:\n    num_workers = (\n        len(tf_config[\"cluster\"].get(\"chief\", [])) +\n        len(tf_config[\"cluster\"].get(\"worker\", [])))","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/common/distribute_utils.py#L185-L221","documentation":"Error \"Unrecognized Distribution Strategy: %r\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/common/distribute_utils.py:203 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"}