Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Unable to predict data using the model trained (Node: 'model/multi_category_encoding/string_lookup_22/None_Lookup/LookupTableFindV2' Table not initialized. [[{{node model/multi_category_encoding/string_lookup_22/None_Lookup/LookupTableFindV2}}]] [Op:__inference_predict_function_10129638] ) #1889

Open
y-sheng opened this issue Jul 18, 2023 · 0 comments

Comments

@y-sheng
Copy link

y-sheng commented Jul 18, 2023

Bug Description

Data: I am training an Autokeras model using a data frame, I preprocessed the df myself, label encoded categorical data and standardscaler for numeric data. The data is split into 0.8 for training and 0.2 for testing. y is numeric data.

Model:I used StructuredDataRegressor to train the model.

Model: "model"


Layer (type) Output Shape Param #

input_1 (InputLayer) [(None, 14)] 0

multi_category_encoding (Mu (None, 14) 0
ltiCategoryEncoding)

normalization (Normalizatio (None, 14) 29
n)

dense (Dense) (None, 16) 240

re_lu (ReLU) (None, 16) 0

regression_head_1 (Dense) (None, 1) 17

=================================================================
Total params: 286
Trainable params: 257
Non-trainable params: 29


Issue: So the model successfully trained, but when I tried to evaluate it, the following error message shown.

1 y_pred = auto_bestcsvmodel.predict(x_test)
  2 r2 = r2_score(y_test, y_pred)
  3 print ('r2_score: %s' % r2)

~\anaconda3\envs\gsv\lib\site-packages\keras\utils\traceback_utils.py in error_handler(*args, **kwargs)
68 # To get the full stack trace, call:
69 # tf.debugging.disable_traceback_filtering()
---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb

~\anaconda3\envs\gsv\lib\site-packages\tensorflow\python\eager\execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
52 try:
53 ctx.ensure_initialized()
---> 54 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
55 inputs, attrs, num_outputs)
56 except core._NotOkStatusException as e:

FailedPreconditionError: Graph execution error:

Detected at node 'model/multi_category_encoding/string_lookup_22/None_Lookup/LookupTableFindV2' defined at (most recent call last):
File "C:\Users\marvel\anaconda3\envs\gsv\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\marvel\anaconda3\envs\gsv\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\ipykernel_launcher.py", line 17, in
app.launch_new_instance()
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\traitlets\config\application.py", line 846, in launch_instance
app.start()
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\ipykernel\kernelapp.py", line 712, in start
self.io_loop.start()
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\tornado\platform\asyncio.py", line 199, in start
self.asyncio_loop.run_forever()
File "C:\Users\marvel\anaconda3\envs\gsv\lib\asyncio\base_events.py", line 601, in run_forever
self._run_once()
File "C:\Users\marvel\anaconda3\envs\gsv\lib\asyncio\base_events.py", line 1905, in _run_once
handle._run()
File "C:\Users\marvel\anaconda3\envs\gsv\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\ipykernel\kernelbase.py", line 510, in dispatch_queue
await self.process_one()
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\ipykernel\kernelbase.py", line 499, in process_one
await dispatch(*args)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\ipykernel\kernelbase.py", line 406, in dispatch_shell
await result
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\ipykernel\kernelbase.py", line 730, in execute_request
reply_content = await reply_content
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\ipykernel\ipkernel.py", line 390, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\ipykernel\zmqshell.py", line 528, in run_cell
return super().run_cell(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\IPython\core\interactiveshell.py", line 2914, in run_cell
result = self._run_cell(
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\IPython\core\interactiveshell.py", line 2960, in _run_cell
return runner(coro)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\IPython\core\async_helpers.py", line 78, in pseudo_sync_runner
coro.send(None)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\IPython\core\interactiveshell.py", line 3185, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\IPython\core\interactiveshell.py", line 3377, in run_ast_nodes
if (await self.run_code(code, result, async
=asy)):
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\IPython\core\interactiveshell.py", line 3457, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "C:\Users\marvel\AppData\Local\Temp\ipykernel_39304\2476633152.py", line 1, in
y_predt_a = auto_bestcsvmodel.predict(epc_test)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\utils\traceback_utils.py", line 65, in error_handler
return fn(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\training.py", line 2253, in predict
tmp_batch_outputs = self.predict_function(iterator)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\training.py", line 2041, in predict_function
return step_function(self, iterator)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\training.py", line 2027, in step_function
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\training.py", line 2015, in run_step
outputs = model.predict_step(data)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\training.py", line 1983, in predict_step
return self(x, training=False)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\utils\traceback_utils.py", line 65, in error_handler
return fn(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\training.py", line 557, in call
return super().call(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\utils\traceback_utils.py", line 65, in error_handler
return fn(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\base_layer.py", line 1097, in call
outputs = call_fn(inputs, *args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\utils\traceback_utils.py", line 96, in error_handler
return fn(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\functional.py", line 510, in call
return self._run_internal_graph(inputs, training=training, mask=mask)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\functional.py", line 667, in _run_internal_graph
outputs = node.layer(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\utils\traceback_utils.py", line 65, in error_handler
return fn(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\base_layer.py", line 1097, in call
outputs = call_fn(inputs, *args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\utils\traceback_utils.py", line 96, in error_handler
return fn(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\autokeras\keras_layers.py", line 99, in call
for input_node, encoding_layer in zip(split_inputs, self.encoding_layers):
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\autokeras\keras_layers.py", line 100, in call
if encoding_layer is None:
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\autokeras\keras_layers.py", line 108, in call
output_nodes.append(
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\utils\traceback_utils.py", line 65, in error_handler
return fn(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\engine\base_layer.py", line 1097, in call
outputs = call_fn(inputs, *args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\utils\traceback_utils.py", line 96, in error_handler
return fn(*args, **kwargs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\layers\preprocessing\index_lookup.py", line 745, in call
lookups = self._lookup_dense(inputs)
File "C:\Users\marvel\anaconda3\envs\gsv\lib\site-packages\keras\layers\preprocessing\index_lookup.py", line 781, in _lookup_dense
lookups = self.lookup_table.lookup(inputs)
Node: 'model/multi_category_encoding/string_lookup_22/None_Lookup/LookupTableFindV2'
Table not initialized.
[[{{node model/multi_category_encoding/string_lookup_22/None_Lookup/LookupTableFindV2}}]] [Op:__inference_predict_function_10129638]

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant