Fixed bugs in SLU example in CNTKBook (section 7.4)
1. Problem: RuntimeError if the full path of the output file doesn’t exist. Fix: make the intermediate dirs for the path of the output file. 2. Problem: Output labels file not written (should be written according to the documentation). Fix: change the rnnlu.config file. 3. Problem: mismatch between the feature and the output files when building the evaluation file. Fix: skip empty lines in the feature file
This commit is contained in:
Родитель
1645818816
Коммит
435d6127d5
|
@ -125,10 +125,11 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
if (outputFileIds.find(outputFile) == outputFileIds.end())
|
||||
{
|
||||
FILE* ofs;
|
||||
msra::files::make_intermediate_dirs(outputFile);
|
||||
string str(outputFile.begin(), outputFile.end());
|
||||
ofs = fopen(str.c_str(), "wt");
|
||||
if (ofs == nullptr)
|
||||
RuntimeError("Cannot open open %s for writing", str.c_str());
|
||||
RuntimeError("Cannot open %s for writing", str.c_str());
|
||||
outputFileIds[outputFile] = ofs;
|
||||
fp = ofs;
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ LSTMTest=[
|
|||
|
||||
modelPath=$ExpDir$\cntkdebug.dnn
|
||||
|
||||
outputNodeNames=outputs
|
||||
outputNodeNames=outputs:labels
|
||||
|
||||
reader=[
|
||||
# reader to use
|
||||
|
@ -442,6 +442,11 @@ LSTMTest=[
|
|||
file=$OutDir$\output.rec.txt
|
||||
token=$DataDir$\output.txt
|
||||
]
|
||||
|
||||
labels=[
|
||||
file=$OutDir$\output.lbl.txt
|
||||
token=$DataDir$\output.txt
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# need to have outputs
|
||||
# in this case is output.rec.txt
|
||||
# need to have outputs and labels
|
||||
# in this case is output.rec.txt and output.lbl.txt
|
||||
|
||||
awk '{str1=$1; getline < "output.rec.txt"; print str1" "$1 > "output.12.txt"}' feat.txt
|
||||
awk 'NF {str1=$1; getline < "output.rec.txt"; print str1" "$1 > "output.12.txt"}' feat.txt
|
||||
|
||||
awk '{str1=$1; str2=$2; getline < "lbl.txt"; print str1" NNP "$1 " "str2 > "output.all.txt"}' output.12.txt
|
||||
awk '{str1=$1; str2=$2; getline < "output.lbl.txt"; print str1" NNP "$1 " "str2 > "output.all.txt"}' output.12.txt
|
||||
|
||||
cat output.all.txt | perl -ne '{chomp;s/\r//g;print $_,"\n";}' | perl conlleval.pl | head -10
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче