[Subject Prev][Subject Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hts-users:02174] ERROR on MacOSX/cygwin environment (about Japanese Demo)


Hi,

On my MacOSX environment, HTS-demo_NIT-ATR503-M001 doesn't work correctly.
Model training stopped as follows.

HMM Def Error: LoadHMMSet: Inconsistent HMM macro name at line 1/col
0/char -1 in
/Users/dsk_saito/work/hts_trial/test/HTS-demo_NIT-ATR503-M001/models/qst001/ver1/cmp/HRest/A
  ERROR [+7050]  HMError:
  ERROR [+2628]  Initialise: LoadHMMSet failed
 FATAL ERROR - Terminating program /usr/local/HTS-2.1_64/bin/HHEd

This error occurred at the "if($MMMMF){}" block in Training.pl .

This error happens because the models "A", "I", "I", "U", "O" and "N"
are overwritten by their "lower-case" models in HInit & HRest step.

This error was also found in the case of Cygwin environment.

Generally, MacOSX / Cygwin file systems cannot distinguish filenames
composed of capital letters from those composed of lower-case ones.

I wrote a patch to avoid this error.
usage:
% cp patchfor_winmac.patch HTS-demo_NIT-ATR503-M001/.
% patch scripts < patchfor_winmac.patch
% ./configure ......

Best regards,

-- 
Daisuke Saito
diff -Nru scripts.org/Config.pm.in scripts/Config.pm.in
--- scripts.org/Config.pm.in	2009-08-14 20:48:22.000000000 +0900
+++ scripts/Config.pm.in	2009-08-14 22:25:41.000000000 +0900
@@ -119,7 +119,13 @@
 #         'E'  => 'e',
 #         'O'  => 'o');
 
-
+%mdrename = ('A' => 'aa', # model rename list for windows/mac environments
+	     'I' => 'ii',
+	     'U' => 'uu',
+	     'E' => 'ee',
+	     'O' => 'oo',
+	     'N' => 'nn');
+	     
 # Speech Analysis/Synthesis Setting ==============
 # speech analysis
 $sr = @SAMPFREQ@;   # sampling rate (Hz)
diff -Nru scripts.org/Training.pl scripts/Training.pl
--- scripts.org/Training.pl	2009-08-14 19:56:57.000000000 +0900
+++ scripts/Training.pl	2009-08-14 21:33:38.000000000 +0900
@@ -64,6 +64,7 @@
 
 # model list files
 $lst{'mon'} = "$datdir/lists/mono.list";
+$lst{'tmp'} = "$datdir/lists/tmp.list"; # for win/mac environment
 $lst{'ful'} = "$datdir/lists/full.list";
 $lst{'all'} = "$datdir/lists/full_all.list";
  
@@ -89,6 +90,7 @@
    $hrest{$set}   = "$model{$set}/HRest";
    $vfloors{$set} = "$model{$set}/vFloors";
    $initmmf{$set} = "$model{$set}/init.mmf";
+   $tmpmmf{$set}  = "$model{$set}/tmp.mmf"; # for win/mac env
    $monommf{$set} = "$model{$set}/monophone.mmf";
    $fullmmf{$set} = "$model{$set}/fullcontext.mmf";
    $clusmmf{$set} = "$model{$set}/clustered.mmf";
@@ -179,6 +181,7 @@
 $HRest          = "$HREST  -A    -C $cfg{'trn'} -D -T 1 -S $scp{'trn'}                -m 1 -u tmvw    -w $wf";
 $HERest{'mon'}  = "$HEREST -A    -C $cfg{'trn'} -D -T 1 -S $scp{'trn'} -I $mlf{'mon'} -m 1 -u tmvwdmv -w $wf -t $beam ";
 $HERest{'ful'}  = "$HEREST -A -B -C $cfg{'trn'} -D -T 1 -S $scp{'trn'} -I $mlf{'ful'} -m 1 -u tmvwdmv -w $wf -t $beam ";
+$HHEd{'mrg'}    = "$HHED   -A    -C $cfg{'trn'} -D -T 1 -p -i"; # for win/mac environment
 $HHEd{'trn'}    = "$HHED   -A -B -C $cfg{'trn'} -D -T 1 -p -i";
 $HHEd{'cnv'}    = "$HHED   -A -B -C $cfg{'cnv'} -D -T 1 -p -i";
 $HMGenS         = "$HMGENS -A -B -C $cfg{'syn'} -D -T 1 -S $scp{'gen'} -t $beam ";
@@ -240,7 +243,10 @@
    print_time("initialization & reestimation");
 
    open(LIST, $lst{'mon'}) || die "Cannot open $!";
-   while ($phone = <LIST>) {
+   open(TMPLIST,">$lst{'tmp'}") || die "Cannot open $!"; # for win/mac env
+   @list = <LIST>;
+   close(LIST);
+   foreach $phone (@list) {
       # trimming leading and following whitespace characters
       $phone =~ s/^\s+//;
       $phone =~ s/\s+$//;
@@ -250,26 +256,36 @@
          next;
       }
       $lab = $mlf{'mon'};
-
+      
       print "=============== $phone ================\n";
+      # for windows / mac environment (A->aa,I->ii,U->uu,E->ee,O->oo,N->nn)
+      $outname = (grep($_ eq $phone, keys %mdrename)>0)?$mdrename{$phone}:$phone;    
       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);
+	  print "use $mdcp{$phone} instead of $phone\n";
+	  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}/$outname") || die "Cannot open $!";
+	      while (<SRC>){
+		  s/~h \"$mdcp{$phone}\"/~h \"$outname\"/;
+		  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");
+         shell("$HInit -H $initmmf{'cmp'} -M $hinit{'cmp'} -I $lab -l $phone -o $outname $prtfile");
+         shell("$HRest -H $initmmf{'cmp'} -M $hrest{'cmp'} -I $lab -l $phone -g $hrest{'dur'}/$outname $hinit{'cmp'}/$outname");
       }
+      print TMPLIST "$outname\n";
    }
-   close(LIST);
+   close(TMPLIST);
 }
 
 
@@ -295,7 +311,17 @@
 
       close(EDFILE);
 
-      shell("$HHEd{'trn'} -d $hrest{$set} -w $monommf{$set} $lvf{$set} $lst{'mon'}");
+      shell("$HHEd{'mrg'} -d $hrest{$set} -w $tmpmmf{$set} $lvf{$set} $lst{'tmp'}");
+      open(TMPMMF,$tmpmmf{$set}) || die "Cannot open $!";
+      open(MONMMF,">$monommf{$set}") || die "Cannot open $!";
+      while(<TMPMMF>){
+	  foreach $mdkey (keys %mdrename){
+	      s/~h \"$mdrename{$mdkey}\"/~h \"$mdkey\"/g;
+	  }
+	  print MONMMF;
+      }
+      close(MONMMF);
+      close(TMPMMF);
       shell("gzip -c $monommf{$set} > $monommf{$set}.nonembedded.gz");
    }
 }
@@ -594,7 +620,7 @@
       
       print "Synthesizing a speech waveform from $lab using hts_engine...";
       shell("$hts_engine -or ${dir}/${base}.raw -ot ${dir}/${base}.trace $lab");
-      shell("$SOX -c 1 -s -w -t raw -r $sr ${dir}/${base}.raw -c 1 -s -w -t wav -r $sr ${dir}/${base}.wav");
+      shell("$SOX -c 1 -s -2 -t raw -r $sr ${dir}/${base}.raw -c 1 -2 -w -t wav -r $sr ${dir}/${base}.wav");
       print "done.\n";
    }
    close(SCP);
@@ -1417,7 +1443,7 @@
          $line = "$EXCITE -p $fs $gendir/$base.pit | "
                . "$MGLSADF -m ".($ordr{'mgc'}-1)." -p $fs -a $fw -g $gm $mgc | "
                . "$X2X +fs | "
-               . "$SOX -c 1 -s -w -t raw -r $sr - -c 1 -s -w -t wav -r $sr $gendir/$base.wav";
+               . "$SOX -c 1 -s -2 -t raw -r $sr - -c 1 -s -2 -t wav -r $sr $gendir/$base.wav";
 
          shell($line);