CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Adaptation do not work

Open minghuaiping opened this issue 10 years ago • 6 comments

I'm trying to apply model adaptation using KLD regularization using CNTK. Seems this feature does not work currently. Here is my config file for model adaptation. BLSTM-MultiTask=[ action=adapt origModelFileName="$OutputDir$/Models_average/VC_MT_AV.dnn" refNodeName=ObjFcn.O Truncated=false modelPath = "$ModelDir$/VC_MTL.dnn" adaptationRegType=KL adaptationRegWeight=0.8

................... ]

According to problems reported in issue252 , I modify the config file and SGD.cpp file in the suggestion. Then, another error occurred:

Starting minibatch loop. getbatch: getting utterances 65..65 (1116 subset of 1116 frames out of 64 requested) in sweep 0 getbatch: getting utterances 66..66 (892 subset of 892 frames out of 64 requested) in sweep 0 getbatch: getting utterances 67..67 (685 subset of 685 frames out of 64 requested) in sweep 0 getbatch: getting utterances 68..68 (948 subset of 948 frames out of 64 requested) in sweep 0 getbatch: getting utterances 69..69 (1714 subset of 1714 frames out of 64 requested) in sweep 0 getbatch: getting utterances 70..70 (767 subset of 767 frames out of 64 requested) in sweep 0 getbatch: getting utterances 71..71 (1205 subset of 1205 frames out of 64 requested) in sweep 0 getbatch: getting utterances 72..72 (1028 subset of 1028 frames out of 64 requested) in sweep 0 getbatch: getting utterances 73..73 (966 subset of 966 frames out of 64 requested) in sweep 0 getbatch: getting utterances 74..74 (836 subset of 836 frames out of 64 requested) in sweep 0 getbatch: getting utterances 75..75 (901 subset of 901 frames out of 64 requested) in sweep 0 Segmentation fault (core dumped)

There is no example for model adaptation in the official documents. Any one have the experience for model adaptation can help?

minghuaiping avatar Jul 29 '16 02:07 minghuaiping

This is indeed not working, since its original implementation used a hack that was incompatible with some larger architectural changes we had made. KL-regularized adaptation is being revamped currently.

The new version will work very differently--you would use BrainScriptNetworkBuilder to create an extended network that contains a read-only copy of the original network, and use that to compute the soft labels to realize the KL-regularized CE criterion.

This link has a sketch at the end on what this would look like. However, I have not been able to test this yet.

Would you like to give it a try? I'd be more than happy to work out possible errors in the example with you. You will need a binary built from master source as of yesterday.

frankseide avatar Jul 29 '16 20:07 frankseide

Hi @frankseide , thank you very much for the information! I would like to try it, but I can not open the link you provide.

minghuaiping avatar Aug 01 '16 01:08 minghuaiping

Hi @frankseide I would also like to try Adaptation. But as @minghuaiping says the link is broken.

lahiruts avatar Aug 04 '16 17:08 lahiruts

Sorry, I updated the link above. It should be this: [[https://github.com/Microsoft/CNTK/wiki/CloneFunction]]

frankseide avatar Aug 04 '16 18:08 frankseide

Hi @frankseide , Here is my configuration: BLSTM-MultiTask=[ action="adapt" BrainScriptNetworkBuilder = (new ComputationNetwork include "$ConfigDir$/DefaultMacros.bs" include "$ConfigDir$/mtl_blstm.bs" ) network=BS.Network.Load("$OutputDir$/Models_average/VC_MT_AV.dnn") # STEP 2: extract a read-only section that is the feature extractor function adptNet = CloneFunction (network.features, [ z = network.z] ,parameters="learnable") refNet = CloneFunction (network.features, [ z = network.z ], parameters="constant")
z = adaptNet (features).z zRef = refNet (features).z

maxEpochs=512
Truncated=false
#Truncated=true
modelPath = "$ModelDir$/VC_MTL.dnn"
adaptationRegType=KL
adaptationRegWeight=0.8

...... ]

Then the follow error occurred.

reading script file ../Data/neut_develop.scp ... 14 entries reading script file ../Data/angr_develop.scp ... 14 entries reading script file ../Data/disg_develop.scp ... 14 entries reading script file ../Data/fear_develop.scp ... 14 entries reading script file ../Data/happ_develop.scp ... 14 entries reading script file ../Data/sadn_develop.scp ... 14 entries reading script file ../Data/surp_develop.scp ... 14 entries ..............feature set 0: 15088 frames in 14 out of 14 utterances minibatchutterancesource: 14 utterances grouped into 1 chunks, av. chunk size: 14.0 utterances, 15088.0 frames ..............feature set 1: 15088 frames in 14 out of 14 utterances minibatchutterancesource: 14 utterances grouped into 1 chunks, av. chunk size: 14.0 utterances, 15088.0 frames ..............feature set 2: 15088 frames in 14 out of 14 utterances minibatchutterancesource: 14 utterances grouped into 1 chunks, av. chunk size: 14.0 utterances, 15088.0 frames ..............feature set 3: 15088 frames in 14 out of 14 utterances minibatchutterancesource: 14 utterances grouped into 1 chunks, av. chunk size: 14.0 utterances, 15088.0 frames ..............feature set 4: 15088 frames in 14 out of 14 utterances minibatchutterancesource: 14 utterances grouped into 1 chunks, av. chunk size: 14.0 utterances, 15088.0 frames ..............feature set 5: 15088 frames in 14 out of 14 utterances minibatchutterancesource: 14 utterances grouped into 1 chunks, av. chunk size: 14.0 utterances, 15088.0 frames ..............feature set 6: 15088 frames in 14 out of 14 utterances minibatchutterancesource: 14 utterances grouped into 1 chunks, av. chunk size: 14.0 utterances, 15088.0 frames Load Network From the original model file .

[CALL STACK] [0x7f0cf259dcb0] Microsoft::MSR::CNTK::File:: Init (wchar_t const_, int) + 0x600 [0x7f0cf259e00f] Microsoft::MSR::CNTK::File:: File (std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>> const&, int) + 0x1f [0x7c59ec] void Microsoft::MSR::CNTK::ComputationNetwork:: Read (std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>> const&) + 0x3c [0x77b4d8] std::shared_ptrMicrosoft::MSR::CNTK::ComputationNetwork Microsoft::MSR::CNTK::ComputationNetwork:: CreateFromFile (int, std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>> const&) + 0x438 [0x7875af] Microsoft::MSR::CNTK::SGD:: Adapt (std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, Microsoft::MSR::CNTK::IDataReader_, Microsoft::MSR::CNTK::IDataReader_, int, bool) + 0x77f [0x6297ec] void DoAdapt (Microsoft::MSR::CNTK::ConfigParameters const&) + 0x4ec [0x5f2730] void DoCommands (Microsoft::MSR::CNTK::ConfigParameters const&, std::shared_ptrMicrosoft::MSR::CNTK::MPIWrapper const&) + 0xd20 [0x592e9c] wmainOldCNTKConfig (int, wchar_t__) + 0xbfc [0x593537] wmain1 (int, wchar_t_*) + 0x87 [0x587f38] main + 0xd8 [0x7f0cf124cf45] __libc_start_main + 0xf5 [0x58b95e]
EXCEPTION occurred: File: filename is empty

minghuaiping avatar Aug 16 '16 03:08 minghuaiping

This issue has been dormant for a long while, please check out the latest CNTK release. If you still run into problems, please open a new issue.

wolfma61 avatar Jul 03 '17 14:07 wolfma61