DeepPicker-python icon indicating copy to clipboard operation
DeepPicker-python copied to clipboard

ValueError: Only call `sparse_softmax_cross_entropy_with_logits` with named arguments (labels=..., logits=..., ...)

Open vidyaprashant opened this issue 6 years ago • 3 comments

Hi, whenever I am trying to train my own model which has only three .mrc images using the following query it results in some errors please anyone help me with solution

(tfg) C:\Users\admin\Desktop\my deeppicker>python train.py --train_type 1 --train_inputDir "mrc" --particle_size 50 --mrc_number 3 --particle_number 3 --coordinate_symbol "_manual_checked" --model_save_dir "trained_model" --model_save_file "model_demo_type1" (0, 64, 64, 1) float64 (0,) int64 (0, 64, 64, 1) float64 (0,) int64 Load training data successfully! Traceback (most recent call last): File "train.py", line 176, in main() File "train.py", line 172, in main train() File "train.py", line 130, in train deepModel.init_model_graph_train() File "C:\Users\admin\Desktop\my deeppicker\deepModel.py", line 160, in init_model_graph_train self.loss_operation = self.__loss(self.__inference(self.train_data_node,train=True)) File "C:\Users\admin\Desktop\my deeppicker\deepModel.py", line 91, in __loss self.train_label_node, name = 'cross_entropy_all') File "C:\Users\admin\Anaconda3\envs\tfg\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 2011, in sparse_softmax_cross_entropy_with_logits labels, logits) File "C:\Users\admin\Anaconda3\envs\tfg\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 1759, in _ensure_xent_args "named arguments (labels=..., logits=..., ...)" % name) ValueError: Only call sparse_softmax_cross_entropy_with_logits with named arguments (labels=..., logits=..., ...)

vidyaprashant avatar Jan 23 '19 12:01 vidyaprashant

Hi, this is caused by the version of Tensorflow. This code is based on an old version of Tensorflow. The new version have changed some functions like the one "sparse_softmax_cross_entropy_with_logits"

nejyeah avatar Jan 28 '19 07:01 nejyeah

will you please help me with the which version of Tensorflow is suitable for the existing code or which function needs to be used instead of "sparse_softmax_cross_entropy_with_logits"

vidyaprashant avatar Feb 20 '19 06:02 vidyaprashant

The versions of Tensorflow suitable for this code is too old to get. You may need to checkout the Tensorflow "sparse_softmax_cross_entropy_with_logits" API of the current version you use.

nejyeah avatar Feb 20 '19 09:02 nejyeah