Don't list Pytorch AIs if it wasn't found, save/load last used AI by name instead of index

This commit is contained in:
n00mkrad
2022-05-31 11:09:56 +02:00
parent 8144b55f90
commit 07b499ba1d
4 changed files with 24 additions and 10 deletions

View File

@@ -109,9 +109,6 @@ namespace Flowframes
{
float factor = arg.Split('=').Last().GetFloat();
interpFactorCombox.Text = factor.ToString();
//if (factor == 2) interpFactorCombox.SelectedIndex = 0;
//if (factor == 4) interpFactorCombox.SelectedIndex = 1;
//if (factor == 8) interpFactorCombox.SelectedIndex = 2;
}
if (arg.StartsWith("ai="))
@@ -272,10 +269,25 @@ namespace Flowframes
void InitAis()
{
foreach (AI ai in Implementations.networks)
aiCombox.Items.Add(ai.friendlyName + " - " + ai.description);
bool pytorchAvailable = Python.HasEmbeddedPyFolder() || Python.IsSysPyInstalled();
foreach (AI ai in Implementations.networks)
{
if (ai.backend == AI.Backend.Pytorch && !pytorchAvailable)
{
Logger.Log($"AI implementation {ai.friendlyName} ({ai.backend}) has not been loaded because Pytorch was not found.", true);
continue;
}
aiCombox.Items.Add(ai.friendlyName + " - " + ai.description);
}
string lastUsedAiName = Config.Get(Config.Key.lastUsedAiName);
aiCombox.SelectedIndex = Implementations.networks.IndexOf(Implementations.networks.Where(x => x.aiName == lastUsedAiName).FirstOrDefault());
if (aiCombox.SelectedIndex < 0) aiCombox.SelectedIndex = 0;
Config.Set(Config.Key.lastUsedAiName, GetAi().aiName);
ConfigParser.LoadComboxIndex(aiCombox);
ConfigParser.LoadComboxIndex(outModeCombox);
}
@@ -460,7 +472,7 @@ namespace Flowframes
interpFactorCombox.SelectedIndex = 0;
if (initialized)
ConfigParser.SaveComboxIndex(aiCombox);
Config.Set(Config.Key.lastUsedAiName, GetAi().aiName);
interpFactorCombox_SelectedIndexChanged(null, null);
fpsOutTbox.ReadOnly = GetAi().factorSupport != AI.FactorSupport.AnyFloat;

View File

@@ -351,6 +351,7 @@ namespace Flowframes.IO
keepSubs,
keepTempFolder,
loopMode,
lastUsedAiName,
lowDiskSpaceCancelGb,
lowDiskSpacePauseGb,
maxFps,

View File

@@ -227,10 +227,9 @@ namespace Flowframes.Magick
}
catch(Exception ex)
{
Logger.Log(ex.Message);
Logger.Log($"Deduplication error: {ex.Message}");
Logger.Log($"Stack Trace:\n{ex.StackTrace}", true);
}
}
File.WriteAllText(Path.Combine(framesPath.GetParentDir(), "dupes.json"), JsonConvert.SerializeObject(frames, Formatting.Indented));

View File

@@ -35,6 +35,7 @@ namespace Flowframes.Os
compact.Start();
compact.BeginOutputReadLine();
compact.BeginErrorReadLine();
while (!compact.HasExited)
{
await Task.Delay(500);
@@ -44,6 +45,7 @@ namespace Flowframes.Os
shownPatienceMsg = true;
await Task.Delay(500);
}
}
Config.Set("compressedPyVersion", Updater.GetInstalledVer().ToString());
Logger.Log("Done compressing python runtime.");