public static async Task RunFlavrCudaProcess(string inPath, string outDir, string script, float interpFactor, string mdl) { string outPath = Path.Combine(inPath.GetParentDir(), outDir); //string uhdStr = await InterpolateUtils.UseUHD() ? "--UHD" : ""; //string wthreads = $"--wthreads {2 * (int)interpFactor}"; //string rbuffer = $"--rbuffer {Config.GetInt("flavrCudaBufferSize", 200)}"; //string scale = $"--scale {Config.GetFloat("flavrCudaScale", 1.0f).ToStringDot()}"; // string prec = Config.GetBool("flavrCudaFp16") ? "--fp16" : ""; string args = $" --input {inPath.Wrap()} --output {outPath.Wrap()} --model {mdl}/{mdl}.pth --factor {interpFactor}"; Process flavrPy = OSUtils.NewProcess(!OSUtils.ShowHiddenCmd()); AiStarted(flavrPy, 4000); SetProgressCheck(Path.Combine(Interpolate.current.tempFolder, outDir), interpFactor); flavrPy.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {Path.Combine(Paths.GetPkgPath(), Networks.flavrCuda.pkgDir).Wrap()} & " + $"set CUDA_VISIBLE_DEVICES={Config.Get("torchGpus")} & {Python.GetPyCmd()} {script} {args}"; Logger.Log($"Running FLAVR (CUDA)...", false); Logger.Log("cmd.exe " + flavrPy.StartInfo.Arguments, true); if (!OSUtils.ShowHiddenCmd()) { flavrPy.OutputDataReceived += (sender, outLine) => { LogOutput(outLine.Data, "flavr-cuda-log"); }; flavrPy.ErrorDataReceived += (sender, outLine) => { LogOutput("[E] " + outLine.Data, "flavr-cuda-log", true); }; } flavrPy.Start(); if (!OSUtils.ShowHiddenCmd()) { flavrPy.BeginOutputReadLine(); flavrPy.BeginErrorReadLine(); } while (!flavrPy.HasExited) { await Task.Delay(1); } }
public static async Task RunRifeCudaProcess(string inPath, string outDir, string script, float interpFactor, string mdl) { //bool parallel = false; string outPath = Path.Combine(inPath.GetParentDir(), outDir); string wthreads = $"--wthreads {2 * (int)interpFactor}"; string rbuffer = $"--rbuffer {Config.GetInt("rifeCudaBufferSize", 200)}"; string scale = $"--scale {Config.GetFloat("rifeCudaScale", 1.0f).ToStringDot()}"; string prec = Config.GetBool("rifeCudaFp16") ? "--fp16" : ""; string args = $" --input {inPath.Wrap()} --output {outDir} --model {mdl} --exp {(int)Math.Log(interpFactor, 2)} {scale} {wthreads} {rbuffer} {prec}"; // if (parallel) args = $" --input {inPath.Wrap()} --output {outPath} --model {mdl} --factor {interpFactor}"; // if (parallel) script = "rife-parallel.py"; Process rifePy = OSUtils.NewProcess(!OSUtils.ShowHiddenCmd()); AiStarted(rifePy, 3500); SetProgressCheck(Path.Combine(Interpolate.current.tempFolder, outDir), interpFactor); rifePy.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {PkgUtils.GetPkgFolder(Packages.rifeCuda).Wrap()} & " + $"set CUDA_VISIBLE_DEVICES={Config.Get("torchGpus")} & {Python.GetPyCmd()} {script} {args}"; Logger.Log($"Running RIFE (CUDA)...".TrimWhitespaces(), false); Logger.Log("cmd.exe " + rifePy.StartInfo.Arguments, true); if (!OSUtils.ShowHiddenCmd()) { rifePy.OutputDataReceived += (sender, outLine) => { LogOutput(outLine.Data, "rife-cuda-log"); }; rifePy.ErrorDataReceived += (sender, outLine) => { LogOutput("[E] " + outLine.Data, "rife-cuda-log", true); }; } rifePy.Start(); if (!OSUtils.ShowHiddenCmd()) { rifePy.BeginOutputReadLine(); rifePy.BeginErrorReadLine(); } while (!rifePy.HasExited) { await Task.Delay(1); } }