[hts-users:02171] ERROR of model copy using %mdcp (about Japanese demo)
Hi,
I found a bug in Training.pl of HTS-demo_NIT-ATR503-M001 .
In the case that %mdcp in Config.pm is uncommented, model training
stopped as follows.
===
Start initialization & reestimation at ----
================================================================================
=============== A ================
use a instead of A
Cannot open No such file or directory at scripts/Training.pl
line 258, <LIST> line 1.
This error happens because "a" model is not created before "A" model.
Though this bug doesn't affect normal model training, it may be a
problem in the case that the amount of training data is very small.
I made a patch for Training.pl about this.
Best regards,
--
Daisuke Saito
--- Training.pl.org 2009-08-14 16:53:24.000000000 +0900
+++ Training.pl 2009-08-14 17:13:37.000000000 +0900
@@ -240,7 +240,9 @@
print_time("initialization & reestimation");
open(LIST, $lst{'mon'}) || die "Cannot open $!";
- while ($phone = <LIST>) {
+ @list = <LIST>;
+ close(LIST);
+ foreach $phone (@list){
# trimming leading and following whitespace characters
$phone =~ s/^\s+//;
$phone =~ s/\s+$//;
@@ -254,22 +256,29 @@
print "=============== $phone ================\n";
if (grep($_ eq $phone, keys %mdcp) > 0){
print "use $mdcp{$phone} instead of $phone\n";
- $set = 'cmp';
- open(SRC, "$hrest{$set}/$mdcp{$phone}") || die "Cannot open $!";
- open(TGT, ">$hrest{$set}/$phone") || die "Cannot open $!";
- while (<SRC>){
- s/~h \"$mdcp{$phone}\"/~h \"$phone\"/;
- print TGT;
- }
- close(TGT);
- close(SRC);
+ if ( ! -e "$hrest{'cmp'}/$mdcp{$phone}"){
+ print "$mdcp{$phone} has not been created yet.\n";
+ print "skip (we will copy it later...).\n";
+ push(@list,$phone);
+ next;
+ }
+ foreach $set (@SET){
+ open(SRC, "$hrest{$set}/$mdcp{$phone}") || die "Cannot open $!";
+ open(TGT, ">$hrest{$set}/$phone") || die "Cannot open $!";
+ while (<SRC>){
+ s/~h \"$mdcp{$phone}\"/~h \"$phone\"/;
+ print TGT;
+ }
+ close(TGT);
+ close(SRC);
+ }
}
else {
shell("$HInit -H $initmmf{'cmp'} -M $hinit{'cmp'} -I $lab -l $phone -o $phone $prtfile");
shell("$HRest -H $initmmf{'cmp'} -M $hrest{'cmp'} -I $lab -l $phone -g $hrest{'dur'}/$phone $hinit{'cmp'}/$phone");
}
}
- close(LIST);
+
}
- Follow-Ups
-
- [hts-users:02172] Re: ERROR of model copy using %mdcp (about Japanese demo), Keiichiro Oura