Graph execution error

I am doing neural network for gas turbine dataset . I have installed tensorflow, keras through pip.
THIS is the error I am getting . tried reinstalling tensorflow and keras.


the error still persists , I have tried chatgpt .but accurate problem solution has not been acquired

@HARIB,

Welcome to the Tensorflow Forum!

Could you please share standalone to reproduce the issue reported here?

Note: Please don’t upload any screenshots.

Thank you!

1 Like

model.fit(×_train_scaled, _train , batch_size 50, epochs 100, verbose=1)

I am using macOS , it isn’t showing any problems in windows .

@HARIB,

On macOS, have you followed the steps as described to install tensorflow?

Thank you!

ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
I have installed tensorflow , followed the steps in the article , ran everything . this is the error that is showing

thank you

Could you please share your macOS details? and what is the command you ran to try to install tensorflow?

Thank you!

Thank you!

1 Like
  1. Processor: 8‑core Apple M1 chip, 2.10 GHz, 12 MB Cache
  2. Memory: 8 GB, or 16 GB LPDDR4X (Onboard)
  3. Storage: 256 GB, or up to 2 TB SSD
  4. Graphics: 8-core Apple M1 GPU
  5. Display: 13.3″, QHD (2560 x 1600)

I ran every steps in in this article in the order said

thank you

@HARIB,

Since you are using Apple M1 computers, to get native performance you can follow the instructions found here.

Thank you!

do I need to uninstall already installed tensorflow?

@HARIB,

do I need to uninstall already installed tensorflow?

Yes.

I did as the you instructed, the last code in the above article shows zsh: parse error near `,', I can assure you it is not a syntax error . I did correct the final code several times , and ran with no positive results.
this is the said code:

import tensorflow as tf

cifar = tf.keras.datasets.cifar100
(x_train, y_train), (x_test, y_test) = cifar.load_data()
model = tf.keras.applications.ResNet50(
    include_top=True,
    weights=None,
    input_shape=(32, 32, 3),
    classes=100,)

loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
model.compile(optimizer="adam", loss=loss_fn, metrics=["accuracy"])
model.fit(x_train, y_train, epochs=5, batch_size=64)

thank you

@HARIB,

To debug above issue, please share complete error log?

Thank you!

the error code is from jupyter notebook

NotFoundError: Graph execution error:

Detected at node ‘StatefulPartitionedCall_4’ defined at (most recent call last):
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/ipykernel_launcher.py”, line 17, in
app.launch_new_instance()
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/traitlets/config/application.py”, line 1043, in launch_instance
app.start()
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/ipykernel/kernelapp.py”, line 712, in start
self.io_loop.start()
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/tornado/platform/asyncio.py”, line 215, in start
self.asyncio_loop.run_forever()
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/asyncio/base_events.py”, line 570, in run_forever
self._run_once()
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/asyncio/base_events.py”, line 1859, in _run_once
handle._run()
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/asyncio/events.py”, line 81, in _run
self._context.run(self._callback, *self._args)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/ipykernel/kernelbase.py”, line 510, in dispatch_queue
await self.process_one()
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/ipykernel/kernelbase.py”, line 499, in process_one
await dispatch(*args)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/ipykernel/kernelbase.py”, line 406, in dispatch_shell
await result
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/ipykernel/kernelbase.py”, line 730, in execute_request
reply_content = await reply_content
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/ipykernel/ipkernel.py”, line 383, in do_execute
res = shell.run_cell(
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/ipykernel/zmqshell.py”, line 528, in run_cell
return super().run_cell(*args, **kwargs)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/IPython/core/interactiveshell.py”, line 2961, in run_cell
result = self._run_cell(
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/IPython/core/interactiveshell.py”, line 3016, in run_cell
result = runner(coro)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/IPython/core/async_helpers.py”, line 129, in pseudo_sync_runner
coro.send(None)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/IPython/core/interactiveshell.py”, line 3221, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/IPython/core/interactiveshell.py”, line 3400, in run_ast_nodes
if await self.run_code(code, result, async
=asy):
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/IPython/core/interactiveshell.py”, line 3460, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/var/folders/2
/9ynm76m50071d99l5fzzwtj40000gn/T/ipykernel_82507/3716583549.py", line 9, in
grid_result = grid.fit(X, y)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/sklearn/model_selection/_search.py”, line 874, in fit
self._run_search(evaluate_candidates)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/sklearn/model_selection/_search.py”, line 1388, in _run_search
evaluate_candidates(ParameterGrid(self.param_grid))
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/sklearn/model_selection/_search.py”, line 821, in evaluate_candidates
out = parallel(
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/sklearn/utils/parallel.py”, line 63, in call
return super().call(iterable_with_config)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/joblib/parallel.py”, line 1085, in call
if self.dispatch_one_batch(iterator):
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/joblib/parallel.py”, line 901, in dispatch_one_batch
self._dispatch(tasks)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/joblib/parallel.py”, line 819, in _dispatch
job = self._backend.apply_async(batch, callback=cb)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/joblib/_parallel_backends.py”, line 208, in apply_async
result = ImmediateResult(func)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/joblib/_parallel_backends.py”, line 597, in init
self.results = batch()
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/joblib/parallel.py”, line 288, in call
return [func(*args, **kwargs)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/joblib/parallel.py”, line 288, in
return [func(*args, **kwargs)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/sklearn/utils/parallel.py”, line 123, in call
return self.function(*args, **kwargs)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/sklearn/model_selection/_validation.py”, line 686, in _fit_and_score
estimator.fit(X_train, y_train, **fit_params)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/wrappers/scikit_learn.py”, line 248, in fit
return super().fit(x, y, **kwargs)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/wrappers/scikit_learn.py”, line 175, in fit
history = self.model.fit(x, y, **fit_args)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/utils/traceback_utils.py”, line 65, in error_handler
return fn(*args, **kwargs)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/engine/training.py”, line 1650, in fit
tmp_logs = self.train_function(iterator)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/engine/training.py”, line 1249, in train_function
return step_function(self, iterator)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/engine/training.py”, line 1233, in step_function
outputs = model.distribute_strategy.run(run_step, args=(data,))
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/engine/training.py”, line 1222, in run_step
outputs = model.train_step(data)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/engine/training.py”, line 1027, in train_step
self.optimizer.minimize(loss, self.trainable_variables, tape=tape)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/optimizers/optimizer_experimental/optimizer.py”, line 527, in minimize
self.apply_gradients(grads_and_vars)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/optimizers/optimizer_experimental/optimizer.py”, line 1140, in apply_gradients
return super().apply_gradients(grads_and_vars, name=name)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/optimizers/optimizer_experimental/optimizer.py”, line 634, in apply_gradients
iteration = self._internal_apply_gradients(grads_and_vars)
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/optimizers/optimizer_experimental/optimizer.py”, line 1166, in _internal_apply_gradients
return tf.internal.distribute.interim.maybe_merge_call(
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/optimizers/optimizer_experimental/optimizer.py”, line 1216, in _distributed_apply_gradients_fn
distribution.extended.update(
File “/Users/haribparol/tensorflow-test/env/lib/python3.8/site-packages/keras/optimizers/optimizer_experimental/optimizer.py”, line 1211, in apply_grad_to_update_var
return self._update_step_xla(grad, var, id(self._var_key(var)))
Node: ‘StatefulPartitionedCall_4’
could not find registered platform with id: 0x152ae9420
[[{{node StatefulPartitionedCall_4}}]] [Op:__inference_train_function_1521]

this is the code which is used to run the model

model = KerasClassifier(build_fn=create_model, verbose=0)

Define the grid search parameters

batch_size = [10, 20, 40]
epochs = [10, 50, 100]

Make a dictionary of the grid search parameters

param_grid = dict(batch_size=batch_size, epochs=epochs)

Build and fit the GridSearchCV

grid = GridSearchCV(estimator=model, param_grid=param_grid, cv=KFold(), verbose=10, error_score=‘raise’)
grid_result = grid.fit(X, y)

successfully installed tensorflow version 2.11.0.
Successfully installed tensorflow-metal-0.7.1
Successfully installed tensorflow-macos 2.11.0

/var/folders/2_/9ynm76m50071d99l5fzzwtj40000gn/T/ipykernel_38472/2231714594.py:1: DeprecationWarning: KerasClassifier is deprecated, use Sci-Keras (GitHub - adriangb/scikeras: Scikit-Learn API wrapper for Keras.) instead. See Migrating from tf.keras.wrappers.scikit_learn — SciKeras 0.9.0 documentation for help migrating.
model = KerasClassifier(build_fn=create_model, verbose=0)
2023-03-13 01:32:22.615410: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
Fitting 5 folds for each of 9 candidates, totalling 45 fits
[CV 1/5; 1/9] START batch_size=10, epochs=10…
2023-03-13 01:32:22.701841: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:418 : NOT_FOUND: could not find registered platform with id: 0x14f1e54a0
2023-03-13 01:32:22.701864: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:418 : NOT_FOUND: could not find registered platform with id: 0x14f1e54a0
2023-03-13 01:32:22.705636: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:418 : NOT_FOUND: could not find registered platform with id: 0x14f1e54a0
2023-03-13 01:32:22.707270: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:418 : NOT_FOUND: could not find registered platform with id: 0x14f1e54a0
2023-03-13 01:32:22.708904: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:418 : NOT_FOUND: could not find registered platform with id: 0x14f1e54a0
2023-03-13 01:32:22.708915: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:418 : NOT_FOUND: could not find registered platform with id: 0x14f1e54a0

@HARIB,

could not find registered platform with id: 0x14f1e54a0

It appears that there is a problem with your system’s installation or setup of Tensorflow.

Could you please share standalone code to reproduce the issue mentioned here?

Thank you!

1 Like

the stand alone code can be found here . hope it helps

@HARIB,

Sorry for the late response.

Successfully installed tensorflow-metal-0.7.1
Successfully installed tensorflow-macos 2.11.0

Here issue with latest version of tfensorflow-macos and tensorlfow-metal. Can you downgrade to tensorflow-macos==2.9 and tensorflow-metal==0.5.0 and let us know? For more details please refer to #721619.

Thank you!

Thank you very much for the info , downgrading to tensorflow-macos==2.9 and tensorflow-metal==0.5.0 did the trick .

I really appreciate your help!

@chunduriv

1 Like

@HARIB,

I am glad your issue is resolved.

I appreciate the confirmation, thank you.

The problem is that in my case I need keras-cv and for that the latest tensorflow required, any other solution except this would be much appreciated