Proper pytorch check

This commit is contained in:
n00mkrad
2022-07-04 10:14:31 +02:00
parent 16aef55e64
commit c8744f26f9
5 changed files with 14 additions and 9 deletions

View File

@@ -31,6 +31,9 @@ namespace Flowframes.Data
PkgDir = pkgDir; PkgDir = pkgDir;
SupportedFactors = supportedFactors; SupportedFactors = supportedFactors;
FactorSupport = factorSupport; FactorSupport = factorSupport;
if (backend == AiBackend.Pytorch)
Description += " (Nvidia Only!)";
} }
} }
} }

View File

@@ -5,7 +5,7 @@ namespace Flowframes.Data
class Implementations class Implementations
{ {
public static AI rifeCuda = new AI(AI.AiBackend.Pytorch, "RIFE_CUDA", "RIFE", public static AI rifeCuda = new AI(AI.AiBackend.Pytorch, "RIFE_CUDA", "RIFE",
"CUDA/Pytorch Implementation of RIFE (Nvidia Only!)", "rife-cuda", AI.InterpFactorSupport.AnyInteger, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }); "CUDA/Pytorch Implementation of RIFE", "rife-cuda", AI.InterpFactorSupport.AnyInteger, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 });
public static AI rifeNcnnVs = new AI(AI.AiBackend.Ncnn, "RIFE_NCNN_VS", "RIFE (NCNN/VS)", public static AI rifeNcnnVs = new AI(AI.AiBackend.Ncnn, "RIFE_NCNN_VS", "RIFE (NCNN/VS)",
"Vulkan/NCNN/VapourSynth Implementation of RIFE", "rife-ncnn-vs", AI.InterpFactorSupport.AnyFloat, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }) { Piped = true }; "Vulkan/NCNN/VapourSynth Implementation of RIFE", "rife-ncnn-vs", AI.InterpFactorSupport.AnyFloat, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }) { Piped = true };
@@ -14,13 +14,13 @@ namespace Flowframes.Data
"Vulkan/NCNN Implementation of RIFE", "rife-ncnn", AI.InterpFactorSupport.AnyFloat, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }); "Vulkan/NCNN Implementation of RIFE", "rife-ncnn", AI.InterpFactorSupport.AnyFloat, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 });
public static AI flavrCuda = new AI(AI.AiBackend.Pytorch, "FLAVR_CUDA", "FLAVR", public static AI flavrCuda = new AI(AI.AiBackend.Pytorch, "FLAVR_CUDA", "FLAVR",
"Experimental Pytorch Implementation of FLAVR (Nvidia Only!)", "flavr-cuda", AI.InterpFactorSupport.Fixed, new int[] { 2, 4, 8 }); "Experimental Pytorch Implementation of FLAVR", "flavr-cuda", AI.InterpFactorSupport.Fixed, new int[] { 2, 4, 8 });
public static AI dainNcnn = new AI(AI.AiBackend.Ncnn, "DAIN_NCNN", "DAIN (NCNN)", public static AI dainNcnn = new AI(AI.AiBackend.Ncnn, "DAIN_NCNN", "DAIN (NCNN)",
"Vulkan/NCNN Implementation of DAIN", "dain-ncnn", AI.InterpFactorSupport.AnyFloat, new int[] { 2, 3, 4, 5, 6, 7, 8 }); "Vulkan/NCNN Implementation of DAIN", "dain-ncnn", AI.InterpFactorSupport.AnyFloat, new int[] { 2, 3, 4, 5, 6, 7, 8 });
public static AI xvfiCuda = new AI(AI.AiBackend.Pytorch, "XVFI_CUDA", "XVFI", public static AI xvfiCuda = new AI(AI.AiBackend.Pytorch, "XVFI_CUDA", "XVFI",
"CUDA/Pytorch Implementation of XVFI (Nvidia Only!)", "xvfi-cuda", AI.InterpFactorSupport.AnyInteger, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }); "CUDA/Pytorch Implementation of XVFI", "xvfi-cuda", AI.InterpFactorSupport.AnyInteger, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 });
public static List<AI> networks = new List<AI> { rifeCuda, rifeNcnnVs, rifeNcnn, flavrCuda, dainNcnn, xvfiCuda }; public static List<AI> networks = new List<AI> { rifeCuda, rifeNcnnVs, rifeNcnn, flavrCuda, dainNcnn, xvfiCuda };

View File

@@ -270,7 +270,7 @@ namespace Flowframes
void InitAis() void InitAis()
{ {
bool pytorchAvailable = Python.HasEmbeddedPyFolder() || Python.IsSysPyInstalled(); bool pytorchAvailable = Python.IsPytorchReady();
foreach (AI ai in Implementations.networks) foreach (AI ai in Implementations.networks)
{ {

View File

@@ -566,8 +566,6 @@ namespace Flowframes.Os
{ {
hasShownError = true; hasShownError = true;
UiUtils.ShowMessageBox($"A python module is missing.\nCheck {logFilename} for details.\n\n{line}", UiUtils.MessageType.Error); UiUtils.ShowMessageBox($"A python module is missing.\nCheck {logFilename} for details.\n\n{line}", UiUtils.MessageType.Error);
if (!Python.HasEmbeddedPyFolder())
Process.Start("https://github.com/n00mkrad/flowframes/blob/main/PythonDependencies.md");
} }
if (!hasShownError && line.ToLower().Contains("no longer supports this gpu")) if (!hasShownError && line.ToLower().Contains("no longer supports this gpu"))

View File

@@ -105,8 +105,12 @@ namespace Flowframes.Os
public static bool IsPytorchReady () public static bool IsPytorchReady ()
{ {
if (HasEmbeddedPyFolder())
return true;
string torchVer = GetPytorchVer(); string torchVer = GetPytorchVer();
if (!string.IsNullOrWhiteSpace(torchVer) && torchVer.Length <= 35)
if (!string.IsNullOrWhiteSpace(torchVer) && torchVer.Length <= 35 && !torchVer.Contains("ModuleNotFoundError"))
return true; return true;
else else
return false; return false;
@@ -118,13 +122,13 @@ namespace Flowframes.Os
{ {
Process py = OsUtils.NewProcess(true); Process py = OsUtils.NewProcess(true);
py.StartInfo.Arguments = "\"/C\" " + GetPyCmd() + " -c \"import torch; print(torch.__version__)\""; py.StartInfo.Arguments = "\"/C\" " + GetPyCmd() + " -c \"import torch; print(torch.__version__)\"";
Logger.Log("[DepCheck] CMD: " + py.StartInfo.Arguments); Logger.Log($"[DepCheck] CMD: {py.StartInfo.Arguments}", true);
py.Start(); py.Start();
py.WaitForExit(); py.WaitForExit();
string output = py.StandardOutput.ReadToEnd(); string output = py.StandardOutput.ReadToEnd();
string err = py.StandardError.ReadToEnd(); string err = py.StandardError.ReadToEnd();
if (!string.IsNullOrWhiteSpace(err)) output += "\n" + err; if (!string.IsNullOrWhiteSpace(err)) output += "\n" + err;
Logger.Log("[DepCheck] Pytorch Check Output: " + output.Trim()); Logger.Log("[DepCheck] Pytorch Check Output: " + output.Trim(), true);
return output; return output;
} }
catch catch