You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any reason you didn;t use "model.fit_generator" in your example?
I tried to use "model.fit_generator" with "transunet_2d", I got below error:
Epoch 1/10
---------------------------------------------------------------------------
InvalidArgumentError Traceback (most recent call last)
<ipython-input-31-dbe9fc5f1d78> in <module>
142 valid_steps = len(valid_ids)//batch_size
143
--> 144 history =model.fit_generator(train_gen, validation_data=valid_gen, steps_per_epoch=train_steps, validation_steps=valid_steps,
145 epochs=epochs)
~/.local/lib/python3.8/site-packages/keras/engine/training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, validation_freq, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
2258 'Please use `Model.fit`, which supports generators.',
2259 stacklevel=2)
-> 2260 return self.fit(
2261 generator,
2262 steps_per_epoch=steps_per_epoch,
~/.local/lib/python3.8/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb
~/.local/lib/python3.8/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:
InvalidArgumentError: Graph execution error:
Detected at node 'transunet_model/patch_extract_1/Reshape' defined at (most recent call last):
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
app.start()
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 612, in start
self.io_loop.start()
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/tornado/platform/asyncio.py", line 149, in start
self.asyncio_loop.run_forever()
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
self._run_once()
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
handle._run()
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/tornado/ioloop.py", line 690, in <lambda>
lambda f: self._run_callback(functools.partial(callback, future))
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/tornado/ioloop.py", line 743, in _run_callback
ret = callback()
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/tornado/gen.py", line 787, in inner
self.run()
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/tornado/gen.py", line 748, in run
yielded = self.gen.send(value)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 365, in process_one
yield gen.maybe_future(dispatch(*args))
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/tornado/gen.py", line 209, in wrapper
yielded = next(result)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/tornado/gen.py", line 209, in wrapper
yielded = next(result)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 543, in execute_request
self.do_execute(
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/tornado/gen.py", line 209, in wrapper
yielded = next(result)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 306, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/ipykernel/zmqshell.py", line 536, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2866, in run_cell
result = self._run_cell(
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2895, in _run_cell
return runner(coro)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
coro.send(None)
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3071, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3263, in run_ast_nodes
if (await self.run_code(code, result, async_=asy)):
File "/opt/aci/sw/anaconda3/2020.07_gcc-4.8.5-bzb/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3343, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-31-dbe9fc5f1d78>", line 144, in <module>
history =model.fit_generator(train_gen, validation_data=valid_gen, steps_per_epoch=train_steps, validation_steps=valid_steps,
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/training.py", line 2260, in fit_generator
return self.fit(
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 64, in error_handler
return fn(*args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/training.py", line 1409, in fit
tmp_logs = self.train_function(iterator)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/training.py", line 1051, in train_function
return step_function(self, iterator)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/training.py", line 1040, in step_function
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/training.py", line 1030, in run_step
outputs = model.train_step(data)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/training.py", line 889, in train_step
y_pred = self(x, training=True)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 64, in error_handler
return fn(*args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/training.py", line 490, in __call__
return super().__call__(*args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 64, in error_handler
return fn(*args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/base_layer.py", line 1014, in __call__
outputs = call_fn(inputs, *args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 92, in error_handler
return fn(*args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/functional.py", line 458, in call
return self._run_internal_graph(
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/functional.py", line 596, in _run_internal_graph
outputs = node.layer(*args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 64, in error_handler
return fn(*args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/engine/base_layer.py", line 1014, in __call__
outputs = call_fn(inputs, *args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 92, in error_handler
return fn(*args, **kwargs)
File "/storage/home/aqa6122/.local/lib/python3.8/site-packages/keras_unet_collection/transformer_layers.py", line 55, in call
patches = tf.reshape(patches, (batch_size, patch_num*patch_num, patch_dim))
Node: 'transunet_model/patch_extract_1/Reshape'
Input to reshape is a tensor with 524288 values, but the requested shape has 131072
[[{{node transunet_model/patch_extract_1/Reshape}}]] [Op:__inference_train_function_30006]
,
The text was updated successfully, but these errors were encountered:
Hi;
Any reason you didn;t use "model.fit_generator" in your example?
I tried to use "model.fit_generator" with "transunet_2d", I got below error:
,
The text was updated successfully, but these errors were encountered: