diff --git a/Code/Data/Implementations.cs b/Code/Data/Implementations.cs index 8396da5..482af9b 100644 --- a/Code/Data/Implementations.cs +++ b/Code/Data/Implementations.cs @@ -6,6 +6,8 @@ namespace Flowframes.Data { class Implementations { + public static bool DisablePython = false; + public static AI rifeCuda = new AI() { Backend = AI.AiBackend.Pytorch, @@ -70,7 +72,6 @@ namespace Flowframes.Data SupportedFactors = new int[] { 2 }, }; - public static List NetworksAll { get @@ -83,7 +84,7 @@ namespace Flowframes.Data { get { - bool pytorchAvailable = Python.IsPytorchReady(); + bool pytorchAvailable = !DisablePython && Python.IsPytorchReady(); if (pytorchAvailable) return NetworksAll; diff --git a/Code/Flowframes.csproj b/Code/Flowframes.csproj index 355760c..aef1704 100644 --- a/Code/Flowframes.csproj +++ b/Code/Flowframes.csproj @@ -124,6 +124,9 @@ packages\WindowsAPICodePack-Shell.1.1.1\lib\Microsoft.WindowsAPICodePack.Shell.dll + + packages\NDesk.Options.0.2.1\lib\NDesk.Options.dll + packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll diff --git a/Code/Os/Python.cs b/Code/Os/Python.cs index 7eb97cb..28b8006 100644 --- a/Code/Os/Python.cs +++ b/Code/Os/Python.cs @@ -1,4 +1,5 @@ -using Flowframes.IO; +using Flowframes.Data; +using Flowframes.IO; using Flowframes.MiscUtils; using Flowframes.Ui; using System; @@ -129,6 +130,9 @@ namespace Flowframes.Os static string GetPytorchVer() { + if(Implementations.DisablePython) + return ""; + try { Process py = OsUtils.NewProcess(true); diff --git a/Code/Program.cs b/Code/Program.cs index 023d6e8..e8bcb55 100644 --- a/Code/Program.cs +++ b/Code/Program.cs @@ -5,6 +5,7 @@ using Flowframes.IO; using Flowframes.MiscUtils; using Flowframes.Os; using Flowframes.Ui; +using NDesk.Options; using System; using System.Collections.Generic; using System.Globalization; @@ -49,6 +50,20 @@ namespace Flowframes ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; + var opts = new OptionSet + { + { "np|no_python", "Disable Python implementations", v => Implementations.DisablePython = v != null }, + }; + + try + { + opts.Parse(Environment.GetCommandLineArgs()); + } + catch (OptionException e) + { + Logger.Log($"Error parsing CLI option: {e.Message}", true); + } + Task.Run(() => DiskSpaceCheckLoop()); fileArgs = Environment.GetCommandLineArgs().Where(a => a[0] != '-' && File.Exists(a)).ToList().Skip(1).ToArray(); args = Environment.GetCommandLineArgs().Where(a => a[0] == '-').Select(x => x.Trim().Substring(1).ToLowerInvariant()).ToArray(); diff --git a/Code/packages.config b/Code/packages.config index 9fcf478..3956c18 100644 --- a/Code/packages.config +++ b/Code/packages.config @@ -16,6 +16,7 @@ +