CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

AN4, the TrainingCriterion is NAN?

Open jren2012 opened this issue 10 years ago • 2 comments

I used the default parameters in the config file "FeedForward.cntk" as: trainingCriterion = "CrossEntropyWithSoftmax". The error described in the title occurred. How can I fix it? revise the learning rate or some other suggestions? Any help is appreciated. @alexeyo26 thanks your answer yesterday --------------------------------------------------------output --------------------------------------------------------------- [CALL STACK] /home/jren/Repos/cntk/build/release/bin/../lib/libcntkmath.so ( Microsoft::MSR::CNTK::DebugUtil::PrintCallStack() + 0xc3 ) [0x7faadab7f053] cntk ( void Microsoft::MSR::CNTK::ThrowFormattedstd::runtime_error(char const_, ...) + 0xdd ) [0x53dccd] cntk ( Microsoft::MSR::CNTK::SGD::TrainOneEpoch(std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase const&, int, unsigned long, Microsoft::MSR::CNTK::IDataReader, double, unsigned long, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::map<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, Microsoft::MSR::CNTK::Matrix, std::less<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, Microsoft::MSR::CNTK::Matrix> > >, std::liststd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase, std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > > const&, std::listMicrosoft::MSR::CNTK::Matrix<float, std::allocatorMicrosoft::MSR::CNTK::Matrix >&, double&, std::vector<double, std::allocator >&, unsigned long&, std::string) + 0x2c26) [0x76e3c6] cntk ( Microsoft::MSR::CNTK::SGD::TrainOrAdaptModel(int, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, bool, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork, std::shared_ptrMicrosoft::MSR::CNTK::ComputationNodeBase, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader) + 0x133b) [0x771eeb] cntk ( Microsoft::MSR::CNTK::SGD::Train(std::functionstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNetwork (int)>, int, Microsoft::MSR::CNTK::IDataReader, Microsoft::MSR::CNTK::IDataReader, bool) + 0x441 ) [0x774831] cntk ( void DoTrain<Microsoft::MSR::CNTK::ConfigParameters, float>(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x22d ) [0x7906ad] cntk ( void DoCommands(Microsoft::MSR::CNTK::ConfigParameters const&) + 0x7bc ) [0x5a64ac] cntk ( wmainOldCNTKConfig(int, wchar_t__) + 0xacb ) [0x53426b] cntk ( wmain1(int, wchar_t_*) + 0x6a ) [0x534a1a] cntk ( main + 0xcc ) [0x526e1c] /lib/x86_64-linux-gnu/libc.so.6 ( __libc_start_main + 0xf0 ) [0x7faad97baa40] cntk ( _start + 0x29 ) [0x52aab9] EXCEPTION occurred: The training criterion is not a number (NAN). Stop

jren2012 avatar Feb 22 '16 20:02 jren2012

EXCEPTION occurred: The training criterion is not a number (NAN). Stop

Means the training diverged. Either model has probem or the hyper parameters have problem.

dongyu888 avatar Feb 22 '16 20:02 dongyu888

Thanks @dongyu888 I ran the command again, it outputted normal results.

jren2012 avatar Feb 22 '16 20:02 jren2012