question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't run inference.py

See original GitHub issue

Hello!
First thanks a lot for your code base! I am trying to run the inference.py without running the training. I downloaded the pre-trained model, and set up the data folders following your instructions. I ran into this error:

/usr/local/lib/python2.7/dist-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version. Instructions for updating: Use the retry module or similar alternatives. INFO:tensorflow:Using default config. INFO:tensorflow:Using config: {‘_save_checkpoints_secs’: 600, ‘_session_config’: None, ‘_keep_checkpoint_max’: 5, ‘_task_type’: ‘worker’, ‘_global_id_in_cluster’: 0, ‘_is_chief’: True, ‘_cluster_spec’: <tensorflow.python.training.server_lib.ClusterSpec object at 0x7f4755d708d0>, ‘_evaluation_master’: ‘’, ‘_save_checkpoints_steps’: None, ‘_keep_checkpoint_every_n_hours’: 10000, ‘_service’: None, ‘_num_ps_replicas’: 0, ‘_tf_random_seed’: None, ‘_master’: ‘’, ‘_num_worker_replicas’: 1, ‘_task_id’: 0, ‘_log_step_count_steps’: 100, ‘_model_dir’: ‘./model’, ‘_save_summary_steps’: 100} [‘dataset/hisi_images/hisi_000001.jpg’] yannuo debug <generator object predict at 0x7f4756090370> INFO:tensorflow:Calling model_fn. INFO:tensorflow:Done calling model_fn. INFO:tensorflow:Graph was finalized. 2018-04-27 16:34:02.949711: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA INFO:tensorflow:Restoring parameters from ./model/model.ckpt-30358 INFO:tensorflow:Running local_init_op. INFO:tensorflow:Done running local_init_op. 2018-04-27 16:34:05.296762: W tensorflow/core/framework/op_kernel.cc:1273] OP_REQUIRES failed at iterator_ops.cc:891 : Invalid argument: Number of ways to split should evenly divide the split dimension, but got split_dim 2 (size = 4) and num_split 3 [[Node: split = Split[T=DT_FLOAT, num_split=3](split/split_dim, ToFloat)]] Traceback (most recent call last): File “inference_save.py”, line 104, in <module> tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py”, line 126, in run _sys.exit(main(argv)) File “inference_save.py”, line 85, in main for pred_dict, image_path in zip(predictions, image_files): File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py”, line 501, in predict preds_evaluated = mon_sess.run(predictions) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py”, line 546, in run run_metadata=run_metadata) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py”, line 1022, in run run_metadata=run_metadata) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py”, line 1113, in run raise six.reraise(*original_exc_info) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py”, line 1098, in run return self._sess.run(*args, **kwargs) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py”, line 1170, in run run_metadata=run_metadata) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py”, line 950, in run return self._sess.run(*args, **kwargs) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py”, line 905, in run run_metadata_ptr) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py”, line 1140, in _run feed_dict_tensor, options, run_metadata) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py”, line 1321, in _do_run run_metadata) File “/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py”, line 1340, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Number of ways to split should evenly divide the split dimension, but got split_dim 2 (size = 4) and num_split 3 [[Node: split = Split[T=DT_FLOAT, num_split=3](split/split_dim, ToFloat)]] [[Node: IteratorGetNext = IteratorGetNextoutput_shapes=[[?,?,?,3]], output_types=[DT_FLOAT], _device=“/job:localhost/replica:0/task:0/device:CPU:0”]]

============================== I couldn’t figure out what went wrong, really appreciate the help.

Thanks !! Yannuo

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
lthngancommented, Dec 4, 2018

I have similar issue with Python 3.5, Tensorflow 1.12, CUDA 8

tensorflow.python.framework.errors_impl.InvalidArgumentError: Number of ways to split should evenly divide the split dimension, but got split_dim 2 (size = 1) and num_split 3 [[{{node split}} = Split[T=DT_FLOAT, num_split=3, _device=“/device:CPU:0”](split/split_dim, ToFloat)]] [[{{node IteratorGetNext}} = IteratorGetNextoutput_shapes=[[?,?,?,3]], output_types=[DT_FLOAT], _device=“/job:localhost/replica:0/task:0/device:CPU:0”]]

0reactions
ningxiangyuncommented, Jul 6, 2019

did u finish this bug?much thanks

My input PNG is RGBA mode.I have finish this bug when I convert PNG to JEPG.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I can't not run the inference.py · Issue #17 - GitHub
Hello, I am trying to run the inference.py. But I met this error: TypeError: Input 'filename' of 'ReadFile' Op has type float32 that...
Read more >
Troubleshoot Neo Inference Errors - Amazon SageMaker
Make sure the first inference (warm-up inference) on a valid input data is done in model_fn() , if you defined a model_fn in...
Read more >
Deploy models to Amazon SageMaker - Hugging Face
This guide will show you how to deploy models with zero-code using the Inference Toolkit. The Inference Toolkit builds on top of the...
Read more >
Sagemaker endpoint with tensorflow container ignoring the ...
I tried to implement this on the inference.py which I'm passing as an entry point, but no matter what I try, the endpoint...
Read more >
Use PyTorch with the SageMaker Python SDK
To train a PyTorch model by using the SageMaker Python SDK: ... so that SageMaker does not inadvertently run your training code at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found