mirror of
https://github.com/n00mkrad/flowframes.git
synced 2026-02-24 12:12:36 +01:00
Move DisablePython around, benchmark NvApi init
This commit is contained in:
@@ -6,8 +6,6 @@ namespace Flowframes.Data
|
||||
{
|
||||
class Implementations
|
||||
{
|
||||
public static bool DisablePython = false;
|
||||
|
||||
public static AI rifeCuda = new AI()
|
||||
{
|
||||
Backend = AI.AiBackend.Pytorch,
|
||||
@@ -84,7 +82,7 @@ namespace Flowframes.Data
|
||||
{
|
||||
get
|
||||
{
|
||||
bool pytorchAvailable = !DisablePython && Python.IsPytorchReady();
|
||||
bool pytorchAvailable = !Python.DisablePython && Python.IsPytorchReady();
|
||||
|
||||
if (pytorchAvailable)
|
||||
return NetworksAll;
|
||||
|
||||
@@ -54,7 +54,6 @@ namespace Flowframes.Forms.Main
|
||||
// Main Tab
|
||||
UiUtils.InitCombox(interpFactorCombox, 0);
|
||||
UiUtils.InitCombox(outSpeedCombox, 0);
|
||||
|
||||
UiUtils.InitCombox(aiModel, 2);
|
||||
// Video Utils
|
||||
UiUtils.InitCombox(trimCombox, 0);
|
||||
@@ -162,11 +161,11 @@ namespace Flowframes.Forms.Main
|
||||
await Python.CheckCompression();
|
||||
await StartupChecks.SymlinksCheck();
|
||||
await StartupChecks.DetectHwEncoders();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log("Non-critical error while performing online checks. See logs for details.");
|
||||
Logger.Log($"{e.Message}\n{e.StackTrace}", true);
|
||||
Logger.Log($"Checks Error: {e.Message}\n{e.StackTrace}", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using NvAPIWrapper;
|
||||
using Flowframes.MiscUtils;
|
||||
using NvAPIWrapper;
|
||||
using NvAPIWrapper.GPU;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,6 +17,7 @@ namespace Flowframes.Os
|
||||
{
|
||||
try
|
||||
{
|
||||
var sw = new NmkdStopwatch();
|
||||
NVIDIA.Initialize();
|
||||
PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();
|
||||
|
||||
@@ -31,7 +33,7 @@ namespace Flowframes.Os
|
||||
|
||||
string gpuNamesList = string.Join(", ", gpuNames);
|
||||
|
||||
Logger.Log($"Initialized Nvidia API. GPU{(gpus.Length > 1 ? "s" : "")}: {gpuNamesList}", true);
|
||||
Logger.Log($"Initialized Nvidia API in {sw.ElapsedMs} ms. GPU{(gpus.Length > 1 ? "s" : "")}: {gpuNamesList}", true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Flowframes.Os
|
||||
{
|
||||
class Python
|
||||
{
|
||||
public static bool DisablePython = false;
|
||||
|
||||
static bool hasCheckedSysPy = false;
|
||||
static bool sysPyInstalled = false;
|
||||
|
||||
@@ -17,7 +19,7 @@ namespace Flowframes.Os
|
||||
|
||||
public static async Task CheckCompression ()
|
||||
{
|
||||
if (Implementations.DisablePython || !HasEmbeddedPyFolder() || (Config.Get(Config.Key.compressedPyVersion) == Updater.GetInstalledVer().ToString()))
|
||||
if (DisablePython || !HasEmbeddedPyFolder() || (Config.Get(Config.Key.compressedPyVersion) == Updater.GetInstalledVer().ToString()))
|
||||
return;
|
||||
|
||||
Program.mainForm.SetWorking(true, false);
|
||||
@@ -110,6 +112,9 @@ namespace Flowframes.Os
|
||||
|
||||
public static bool IsPytorchReady (bool clearCachedValue = false)
|
||||
{
|
||||
if (DisablePython)
|
||||
return false;
|
||||
|
||||
if (clearCachedValue)
|
||||
pytorchReadyCached = null;
|
||||
|
||||
@@ -128,7 +133,7 @@ namespace Flowframes.Os
|
||||
|
||||
static string GetPytorchVer()
|
||||
{
|
||||
if(Implementations.DisablePython)
|
||||
if(DisablePython)
|
||||
return "";
|
||||
|
||||
try
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Flowframes
|
||||
|
||||
var opts = new OptionSet
|
||||
{
|
||||
{ "np|no_python", "Disable Python implementations", v => Implementations.DisablePython = v != null },
|
||||
{ "np|no_python", "Disable Python implementations", v => Python.DisablePython = v != null },
|
||||
};
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user