raise ValueError('Unexpected result of `predict_function` '

Issue #10 resolved
mengyan created an issue

Hi Simon,

You did a excellent work for iPHoP. But when I use the code “iphop predict --fa_file bigger10k.part_003.fasta --db_dir iphop_db/Sept_2021_pub --out_dir output“, the following error was occured:

“Traceback (most recent call last):
File "/home/Public/Anaconda3/ENTER/envs/iphop_env/bin/iphop", line 10, in <module>
sys.exit(cli())
File "/home/Public/Anaconda3/ENTER/envs/iphop_env/lib/python3.8/site-packages/iphop/iphop.py", line 121, in cli
args"func"
File "/home/Public/Anaconda3/ENTER/envs/iphop_env/lib/python3.8/site-packages/iphop/modules/master_predict.py", line 98, in main
runmodels.run_individual_models(args)
File "/home/Public/Anaconda3/ENTER/envs/iphop_env/lib/python3.8/site-packages/iphop/modules/runmodels.py", line 55, in run_individual_models
full_predicted = run_single_classifier_rf(classifier,args["matrix_blast_rf"],args,full_matrix_labels)
File "/home/Public/Anaconda3/ENTER/envs/iphop_env/lib/python3.8/site-packages/iphop/modules/runmodels.py", line 265, in run_single_classifier_rf
batch_predicted = best_model.predict(tfdf.keras.pd_dataframe_to_tf_dataset(feature_matrix))
File "/home/Public/Anaconda3/ENTER/envs/iphop_env/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/Public/Anaconda3/ENTER/envs/iphop_env/lib/python3.8/site-packages/keras/engine/training.py", line 1804, in predict

raise ValueError('Unexpected result of predict_function '
ValueError: Unexpected result of predict_function (Empty batch_outputs). Please use Model.compile(..., run_eagerly=True), or tf.config.run_functions_eagerly(True) for more information of where went wrong, or file a issue/bug to tf.keras.”

The attachment is my input file.

Could you help me with the problem? Thanks in advance!

mengyan

Comments (3)

  1. Simon Roux repo owner

    Hi !

    I was initially worried that this was a Keras issue, but actually it’s simpler (and more stupid) than this. In essence, this is similar to issue #5 (https://bitbucket.org/srouxjgi/iphop/issues/5/keyerror-n-match).

    The bottom line is: if some methods come back with 0 results (in this case blast), this creates some empty files that are not always handled well. This is on our todolist to fix, but it will take a few weeks (at least). In the meantime, the same process that helped with issue 5 should work here, i.e.:

    Hopefully this helps run iPHoP for now, while waiting for the bugfix !

  2. Log in to comment