/// <summary> /// Get the recommended core num for this processing, just a empirical value. /// </summary> /// <param name="nameVC">The name of VC.</param> /// <param name="speechDuration">Speech duration in seconds.</param> /// <returns>RecToken.</returns> public static int GetRecommendedTokenNum(string nameVC, double speechDuration) { // a random number. int totalToken = 10; if (!string.IsNullOrEmpty(nameVC)) { VCList vclist = new VCList(); totalToken = vclist.GetVcTokeNum(nameVC); } // Min(Max(30,recommend core for the data size), 80%*total cores). // Linear curve. // [0,0]->[10000,1000]->[x,1000]. // 10000hours allocated with 1000 cores. int recTokenNum = Convert.ToInt32(speechDuration * 1000.0 / (10000.0 * 3600.0)); int maxTokenNum = Convert.ToInt32(totalToken * 80.0 / 100.0); int minTokenNum = DefaulMinTokenNum; recTokenNum = Math.Min(Math.Max(minTokenNum, recTokenNum), maxTokenNum); return recTokenNum; }
private int GetTokenNum() { // A random number. int totalToken = 10; if (!string.IsNullOrEmpty(configVC.VcName)) { VCList vclist = new VCList(); totalToken = vclist.GetVcTokeNum(configVC.VcName); } return totalToken; }