{"record":{"id":"624bb00d1d74a691","repo":"keras-team/keras","slug":"only-vocabulary-dtype-int64-is-supported-at-th","errorCode":null,"errorMessage":"Only `vocabulary_dtype='int64'` is supported at this time. Received: vocabulary_dtype={vocabulary_dtype}","messagePattern":"Only `vocabulary_dtype='int64'` is supported at this time\\. Received: vocabulary_dtype=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/preprocessing/integer_lookup.py","lineNumber":374,"sourceCode":"                \"Install it via `pip install tensorflow`.\"\n            )\n        if max_tokens is not None and max_tokens <= 1:\n            raise ValueError(\n                \"If `max_tokens` is set for `IntegerLookup`, it must be \"\n                f\"greater than 1. Received: max_tokens={max_tokens}\"\n            )\n        if num_oov_indices < 0:\n            raise ValueError(\n                \"The value of `num_oov_indices` argument for `IntegerLookup` \"\n                \"must >= 0. Received: num_oov_indices=\"\n                f\"{num_oov_indices}\"\n            )\n        if sparse and backend.backend() != \"tensorflow\":\n            raise ValueError(\n                \"`sparse=True` can only be used with the TensorFlow backend.\"\n            )\n        if vocabulary_dtype != \"int64\":\n            raise ValueError(\n                \"Only `vocabulary_dtype='int64'` is supported \"\n                \"at this time. Received: \"\n                f\"vocabulary_dtype={vocabulary_dtype}\"\n            )\n        super().__init__(\n            max_tokens=max_tokens,\n            num_oov_indices=num_oov_indices,\n            mask_token=mask_token,\n            oov_token=oov_token,\n            vocabulary=vocabulary,\n            vocabulary_dtype=vocabulary_dtype,\n            idf_weights=idf_weights,\n            invert=invert,\n            output_mode=output_mode,\n            sparse=sparse,\n            pad_to_max_tokens=pad_to_max_tokens,\n            oov_method=oov_method,\n            salt=salt,","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/preprocessing/integer_lookup.py#L356-L392","documentation":"IntegerLookup currently supports only vocabulary_dtype='int64'. __init__ rejects any other dtype string because the underlying lookup tables are typed to int64 indices.","triggerScenarios":"Passing vocabulary_dtype='int32', 'float32', or anything other than 'int64' to keras.layers.IntegerLookup().","commonSituations":"Memory-optimization attempts to shrink vocabularies with int32; copying a config from another layer type that accepts dtype options; Keras 3 ports of older layers.","solutions":["Omit vocabulary_dtype (default is int64)","Cast your vocabulary array to int64: np.asarray(vocab, dtype='int64')","If you need int32 output, cast after the layer: keras.ops.cast(layer(x), 'int32')"],"exampleFix":"// before\nlayer = IntegerLookup(vocabulary_dtype='int32')\n// after\nlayer = IntegerLookup()  # int64 default; cast output later if needed","handlingStrategy":"validation","validationCode":"assert vocabulary_dtype in (None, 'int64')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit vocabulary_dtype; cast outputs post-layer instead"],"tags":["keras","dtype","integer-lookup","argument-validation"],"backgroundTag":"unsupported-dtype","analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}