Skip to content

Commit

Permalink
add destination for model option
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Oct 13, 2024
1 parent 12806c2 commit 581baae
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/train_phonemizer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ func error_abs(a, b uint32) uint32 {

func main() {
cleantsv := flag.String("cleantsv", "", "clean tsv dataset for the language")
dstmodel := flag.String("dstmodel", "", "model destination .json.lzw file")
flag.Parse()

var improved_success_rate = 0

if cleantsv == nil || *cleantsv == "" {
println("clean tsv is mandatory")
return
Expand Down Expand Up @@ -133,6 +136,14 @@ func main() {
println(err.Error())
}

if dstmodel != nil && len(*dstmodel) > 0 && improved_success_rate < success {
improved_success_rate = success
err := net.WriteCompressedWeightsToFile(*dstmodel)
if err != nil {
println(err.Error())
}
}

if success == 100 {
println("Max accuracy or wrong data. Exiting")
os.Exit(0)
Expand Down

0 comments on commit 581baae

Please sign in to comment.