 Op type not registered 'DisableCopyOnRead'
@pedro21900 
If you're loading a SavedModel that contains operations from TensorFlow Contrib, you need to ensure that TensorFlow Contrib is installed and accessible. 
In order to expedite the trouble-shooting process here,Could you please fill the issue [template](https://github.com/tensorflow/tensorflow/issues/new/choose),
Thank you! I didn't use tf contrib.

this is my code in python

```python

import pandas as pd

import seaborn as sns

import matplotlib.pyplot as plt

import numpy as np

import tensorflow as tf


# Carregar dados localmente de um arquivo Excel
sheet = pd.read_excel("/content/drive/MyDrive/dados_treinamento_ml/evidencias.xlsx")
sheet.columns= ['task','difficulty','activity','desc']

df = sheet
#['task','difficulty','activity','desc']
# Definir a função concat_names antes de usá-la
def concat_names(row):

    # Verificar se cada coluna não é nula antes de concatenar
    task = str(row['task']) if not pd.isnull(row['task']) else ''
    difficulty = str(row['difficulty']) if not pd.isnull(row['difficulty']) else ''
    if pd.notna(row['activity']) and not str(row['activity']).isdigit():
        return None  # Retorna None para indicar que a linha deve ser ignorada

    activity = str(int(row['activity'])) if not pd.isnull(row['activity']) else ''


    # Realizar a concatenação
    return task + ' - ' + difficulty + ' - ' + activity

# Aplicar a função à nova coluna 'label'
df['label'] = df.apply(concat_names, axis=1)



# Remover colunas desnecessárias
df.drop(['task', 'difficulty', 'activity'], axis=1, inplace=True)
df.columns = ['text','label']
# # Exibir o DataFrame resultante
df.head()


!pip install unidecode

from unidecode import unidecode
from nltk.corpus import stopwords
import nltk

nltk.download('stopwords')
nltk.download('rslp')

def preprocess_text(text):
    #remove acentos
    text = unidecode(text)
    # Converter para minúsculas
    text = text.lower()
    # Remover stopwords
    stop_words = set(stopwords.words('portuguese'))
    text = ' '.join(word for word in text.split() if word not in stop_words)
    return text


# Aplicar pré-processamento ao DataFrame
df['text'] = df['text'].apply(preprocess_text)


from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences

MAX_SEQUENCE_LENGTH = 400
tokenizer = Tokenizer()
tokenizer.fit_on_texts(df['text'])
X = tokenizer.texts_to_sequences(df['text'])
X = pad_sequences(X, maxlen=MAX_SEQUENCE_LENGTH)
X.shape


from sklearn.preprocessing import LabelEncoder
from tensorflow.keras.utils import to_categorical

label_encoder = LabelEncoder()
Y = label_encoder.fit_transform(df['label'])

# Converter rótulos para one-hot encoding
Y = to_categorical(Y)

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size = 0.2, random_state = 5)


from gensim.models import KeyedVectors
from tensorflow.keras.layers import Embedding

# Caminho para o arquivo GloVe pré-treinado
glove_file = '/content/drive/MyDrive/ml_libs/glove_s300.txt'
# Carregar o modelo GloVe
glove_model = KeyedVectors.load_word2vec_format(glove_file)

# Dimensão do embedding
embedding_dim = 300


# Criar uma matriz de embedding para o seu vocabulário
embedding_matrix = np.zeros((len(tokenizer.word_index) + 1, embedding_dim))
for word, i in tokenizer.word_index.items():
    if word in glove_model:
        embedding_vector = glove_model[word]
        embedding_matrix[i] = embedding_vector



modelo = tf.keras.models.Sequential()
# Adicionar camada de embedding ao modelo Keras
modelo.add(Embedding(len(tokenizer.word_index) + 1,
                            embedding_dim,
                            weights=[embedding_matrix],
                            input_length=MAX_SEQUENCE_LENGTH,
                            trainable=False))  # Defina como True se desejar treinar os embeddings
modelo.add(tf.keras.layers.Dropout(0.5))  # Adicionando Dropout para evitar overfitting
modelo.add(tf.keras.layers.Conv1D(64, 5, padding="valid", activation="relu", strides=2))
modelo.add(tf.keras.layers.GlobalMaxPooling1D())
modelo.add(tf.keras.layers.Dense(Y.shape[1], activation='softmax'))
# Compilação do modelo
modelo.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])

# Treinamento do modelo
epochs_hist = modelo.fit(X_train, y_train, epochs=50, batch_size = 50, validation_split=0.2)


# Pré-processamento do texto de exemplo
texto_tokenizado = tokenizer.texts_to_sequences(["Ajuste no banco de dados"])
texto_pad = pad_sequences(texto_tokenizado, maxlen=MAX_SEQUENCE_LENGTH)

# Aplicação do modelo para fazer a previsão
previsao_probabilidades = modelo.predict(texto_pad)
predicted_labels = np.argmax(previsao_probabilidades, axis=1)
predicted_labels_original = label_encoder.inverse_transform(predicted_labels)
# Agora, você pode acessar os valores reais das labels originais
print(predicted_labels_original)
```
but my error is in java @pedro21900 Could you please let us know the TF version you are using here?
I tried to replicate the issue and faced another [error](https://colab.research.google.com/gist/sushreebarsa/159fb268b06d7e90f30d20452758dc08/62489.ipynb) so could you please provide all the dependencies to replicate the issue reported. Thank you! The version I'm using is tensorflow is 2.14.0.

These are all imports:

```python
import pandas as pd

import seaborn as sns

import matplotlib.pyplot as plt

import numpy as np

import tensorflow as tf


from unidecode import unidecode
from nltk.corpus import stopwords
import nltk

from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences

from sklearn.preprocessing import LabelEncoder
from tensorflow.keras.utils import to_categorical

from gensim.models import KeyedVectors
from tensorflow.keras.layers import Embedding

```
and in java it is used

```xml
		<dependency>
			<groupId>org.tensorflow</groupId>
			<artifactId>tensorflow</artifactId>
			<version>1.15.0</version>
		</dependency>

```
code in java 

```java
package site.horizon.fillevidence.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.tensorflow.*;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;

@Slf4j
@Service
public class TensorFlowInferenceService {

    public void exec() {
        try {

            // Carregar o modelo SavedModel
            SavedModelBundle model = SavedModelBundle.load("ml_fill_evidence", "serve");
            Session sess = model.session();

            // Texto de entrada (substitua isso pela sua entrada)
            String entrada = "AJUSTES NA VIEW DE POPULAÇÃO DE BANCO LOCAL - BANCO";

            // Pré-processamento da entrada
            byte[] textoBytes = entrada.getBytes(StandardCharsets.UTF_8);
            Tensor<String> inputTensor = Tensor.create(textoBytes, String.class);


            // Execute a inferência
            Tensor<?> result = sess.runner()
                    .feed("embedding_input", inputTensor)  // Use o nome correto da entrada
                    .fetch("dense")  // Use o nome correto da saída
                    .run()
                    .get(0);

            // Obtenha o resultado como um array de bytes
            byte[] resultadoBytes = new byte[(int) result.numElements()];
            result.copyTo(resultadoBytes);

            // Converta os bytes de volta para uma String
            String resultadoString = new String(resultadoBytes, StandardCharsets.UTF_8);

            // Pós-processamento
            // A parte equivalente ao np.argmax no Python
            // (neste exemplo, apenas exibe a classe prevista como string)
            String[] classes = resultadoString.split(","); // Supondo que as classes são separadas por vírgula
            String predictedLabel = Arrays.stream(classes)
                    .max(String::compareTo)
                    .orElse("Classe não encontrada");

            // Exiba o resultado
            System.out.println("Resultado: " + predictedLabel);

            // Feche o modelo
            model.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

```

 Any ideas what to do Hi @pedro21900 could you make sure that the Java TF version is set to 0.5.0 or later (corresponds with TF > 2.10)? https://github.com/tensorflow/java/#tensorflowjava-version-support This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. ```xml 
<dependency>
			<groupId>org.tensorflow</groupId>
			<artifactId>tensorflow</artifactId>
			<version>1.15.0</version>
</dependency>
``` My guess is that you have multiple TensorFlow binaries, at least one used by Python and one by Java, and they are different versions. There were changes to TensorFlow in April 2022 related to `DisableCopyOnRead`. My guess is version 2.13 is the first release with this. If the version of TensorFlow used when running under Java was old, it would not have this op. Consistently using the same version, whether an older or a newer version should fix this. Rebuilding the one that generates the error so it uses a newer version is a possible solution.

Please comment again if this doesn't match your problem. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62489">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62489">No</a>

I'm running my model in java and I get this error. My project was all done in Python, what should I do to solve this problem? Do I register this in Python or adjust it in Java?


Restoring SavedModel bundle.

```python
2023-11-27 16:43:21.653275: I tensorflow/cc/saved_model/loader.cc:151] Running initialization op on SavedModel bundle at path: /home/lenonn/git/fill-evidence/src/main/resources/ml_fill_evidence
2023-11-27 16:43:21.656519: I tensorflow/cc/saved_model/loader.cc:311] SavedModel load for tags { serve }; Status: success. Took 46958 microseconds.
org.tensorflow.TensorFlowException: Op type not registered 'DisableCopyOnRead' in binary running on rpawsds077523. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.
        at org.tensorflow.SavedModelBundle.load(Native Method)
        at org.tensorflow.SavedModelBundle.access$000(SavedModelBundle.java:27)
        at org.tensorflow.SavedModelBundle$Loader.load(SavedModelBundle.java:32)
        at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:95)
        at site.horizon.fillevidence.service.TensorFlowInferenceService.exec(TensorFlowInferenceService.java:28)
        at site.horizon.fillevidence.FillEvidenceApplication.run(FillEvidenceApplication.java:28)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:768)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:752)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
        at site.horizon.fillevidence.FillEvidenceApplication.main(FillEvidenceApplication.java:21)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50)

```