Example #1
0
func main() {
	var list, scope, root, lm string
	var manual bool
	flag.StringVar(&root, "root", "", "root path")
	flag.StringVar(&lm, "lm", "", "language model")
	flag.StringVar(&list, "list", "", "task list")
	flag.StringVar(&scope, "scope", "-1", "scope: number ,1-3,4,5 ")
	flag.BoolVar(&manual, "manual", false, "manual to control servers (default=false) ")
	flag.Parse()
	kaldi.Init(root, lm)
	defer kaldi.Uninit()
	kaldi.Trace().Println("task-run")
	if !manual {
		kaldi.DevInstance().AutoSync()
		kaldi.DevInstance().SortGpu()
		kaldi.DevInstance().PrintNodes(true)
		kaldi.DevInstance().SortCpu()
		kaldi.DevInstance().PrintNodes(false)
	}

	if list != "" {
		RunMultiTask(list)
		return
	}

	if flag.NArg() < 1 {
		fmt.Println("No enough args!")
		return
	}
	tag := flag.Arg(0)
	kaldi.Trace().Println("tag", tag)
	RunTask(tag, scope)
}
Example #2
0
func main() {
	var vars bool
	var feat, dy, tag string
	flag.StringVar(&feat, "feat", "mfcc", "mfcc, bnf(default)")
	flag.StringVar(&dy, "dy", "delta", "raw, delta(default) ")
	flag.StringVar(&tag, "tag", "", "anything, normal(default)")
	flag.BoolVar(&vars, "vars", false, "true, false(default)")
	flag.PrintDefaults()
	flag.Parse()

	kaldi.Init()
	defer kaldi.Uninit()
	kaldi.Trace().Println("train-dnn")

	dt := kaldi.NewDnnTask(feat)
	dt.TaskConf.Btrain = true
	dt.TaskConf.Bdecode = true
	dt.Dnn.ModelConf.Dynamic = dy
	dt.Dnn.ModelConf.Norm.Cmvn.Mean = true
	dt.Dnn.ModelConf.Norm.Cmvn.Vars = vars
	kaldi.WriteTask(dt)
	if err := dt.Run(); err != nil {
		kaldi.Err().Println()
	}

}
Example #3
0
func main() {
	var update bool
	flag.BoolVar(&update, "u", false, "update server")
	flag.Parse()
	kaldi.Init("", "")
	defer kaldi.Uninit()
	if !kaldi.GridClient().Inited() {
		kaldi.Err().Println("Grid Client no initlized!")
		return
	}
	if update {
		fmt.Println("Update grid nodes")
		kaldi.GridClient().Update()
	}
	fmt.Println("========= Gpu Sort =========")
	for _, n := range kaldi.GridClient().GpuSort() {
		fmt.Printf("Node:%s, GpuUsage:%04.2f, GpuMem:%04.2f \n", n.Node, n.GpuUsage(), n.GpuMem)
	}

	fmt.Println("========= Cpu Sort =========")
	for _, n := range kaldi.GridClient().CpuSort() {
		fmt.Printf("Node:%s, CpuUsage:%04.2f, CPU(s):%02d, CPU MHz: %04.2f, LoadAve:%02.2f\n",
			n.Node, n.CpuUsage(), n.CpuNum, n.CpuMHz, n.LoadAve)
	}
}
Example #4
0
func main() {
	var manual bool
	var gpu bool
	flag.BoolVar(&manual, "manual", false, "manual to control servers (default=false) ")
	flag.BoolVar(&gpu, "g", false, "gpu dependenc")
	flag.Parse()
	kaldi.Init("", "")
	defer kaldi.Uninit()

	if flag.NArg() == 0 {
		kaldi.Trace().Println("No enough args!")
		return
	}

	cmd := strings.Join(flag.Args(), " ")
	var err error

	if manual {
		err = kaldi.BashRun(cmd)
	} else {
		if gpu {
			err = kaldi.GpuBashRun(cmd)
		} else {
			err = kaldi.CpuBashRun(cmd)
		}
	}

	if err != nil {
		kaldi.Err().Println("Cmd Err:", cmd, "\t", err)
		os.Exit(1)
	}
}
Example #5
0
func main() {

	kaldi.Init()
	defer kaldi.Uninit()
	kaldi.Trace().Println("train-mono")
	m := kaldi.NewMonoTask()
	kaldi.WriteTask(m)
	if err := m.Run(); err != nil {
		kaldi.Err().Println()
	}
}
Example #6
0
func main() {
	kaldi.Init("", "")
	defer kaldi.Uninit()
	kaldi.DevInstance().AutoSync()
	kaldi.DevInstance().SortGpu()
	kaldi.DevInstance().PrintNodes(true)
	kaldi.DevInstance().SortCpu()
	kaldi.DevInstance().PrintNodes(false)

	rpc.Register(kaldi.DevInstance().RPC())
	l, e := net.Listen("tcp", ":9001")
	if e != nil {
		kaldi.Err().Println("Grid Svr listen error:", e)
	}

	rpc.Accept(l)
}
Example #7
0
func main() {
	var name string
	flag.StringVar(&name, "name", "tri2.cmn", "tri2.cmn(default)")
	flag.PrintDefaults()
	flag.Parse()

	kaldi.Init()
	defer kaldi.Uninit()
	kaldi.Trace().Println("mk-fmllr")

	f := kaldi.NewFmllrTask()
	f.Src.Name = name
	f.Src.Exp = "GMM"

	kaldi.WriteTask(f)
	if err := f.Run(); err != nil {
		kaldi.Err().Println()
	}

}
Example #8
0
func main() {
	var dy string
	var vars bool
	flag.StringVar(&dy, "dy", "raw", "raw(default),delta")
	flag.BoolVar(&vars, "vars", false, "flase(default)")
	flag.PrintDefaults()
	flag.Parse()
	kaldi.Init()
	defer kaldi.Uninit()

	kaldi.Trace().Println("mk-bnf")
	b := kaldi.NewBnfTask()
	b.ModelConf.Dynamic = dy
	b.ModelConf.Norm.Cmvn.Vars = vars
	kaldi.WriteTask(b)
	// if err := b.Run(); err != nil {
	// 	kaldi.Err().Println()
	// }

}
Example #9
0
func main() {
	var vars bool
	var feat, dy string
	flag.StringVar(&feat, "feat", "mfcc", "mfcc, bnf(default)")
	flag.StringVar(&dy, "dy", "delta", "raw, delta(default) ")
	flag.BoolVar(&vars, "vars", false, "true, false(default)")
	flag.PrintDefaults()
	flag.Parse()

	kaldi.Init()
	defer kaldi.Uninit()
	kaldi.Trace().Println("train-gmm")
	g := kaldi.NewGmmTask(feat)
	g.ModelConf.Dynamic = dy
	g.ModelConf.Norm.Cmvn.Mean = true
	g.ModelConf.Norm.Cmvn.Vars = vars
	kaldi.WriteTask(g)
	if err := g.Run(); err != nil {
		kaldi.Err().Println()
	}
}
Example #10
0
func main() {
	var manual bool
	var num int
	flag.BoolVar(&manual, "manual", false, "manual to control servers (default=false) ")
	flag.IntVar(&num, "n", 4, "number of parallel processing")
	flag.Parse()
	kaldi.Init("", "")
	defer kaldi.Uninit()
	kaldi.Trace().Println("cmd-run")

	if flag.NArg() == 0 {
		kaldi.Trace().Println("No enough args!")
		return
	}

	config := flag.Arg(0)
	kaldi.Trace().Println("The first Arg:", config)

	cfgs := ParseCFGFile(config)
	kaldi.Trace().Println(cfgs)
	ApplyCmds(cfgs, num)
}
Example #11
0
func main() {
	var tag string
	flag.StringVar(&tag, "tag", "normal", "normal(default)")
	flag.PrintDefaults()
	flag.Parse()
	kaldi.Init()
	defer kaldi.Uninit()
	kaldi.Trace().Println("mk-cmvn")
	if flag.NArg() < 1 {
		kaldi.Err().Println("no enough args for feature type")
	}

	for _, feat := range flag.Args() {
		c := kaldi.NewCmvnTask()
		c.Feat = feat
		kaldi.WriteTask(c)
		if err := c.Run(); err != nil {
			kaldi.Err().Println()
		}
	}

}
Example #12
0
func main() {
	var feat, dy, tag string
	flag.StringVar(&feat, "feat", "mfcc", "mfcc, bnf(default)")
	flag.StringVar(&dy, "dy", "delta", "raw, delta(default) ")
	flag.StringVar(&tag, "tag", "", "anything, normal(default)")
	flag.PrintDefaults()
	flag.Parse()

	kaldi.Init()
	defer kaldi.Uninit()
	kaldi.Trace().Println("mk-align")
	a := kaldi.NewAlignTask(feat)
	a.Dynamic = dy
	for _, name := range flag.Args() {
		kaldi.Trace().Println("Make alignment of name :", name)
		a.Name = name
		kaldi.WriteTask(a)
		if err := a.Run(); err != nil {
			kaldi.Err().Println()
		}
	}
}