Server manager with ping check, better error handling for missing model files

This commit is contained in:
N00MKRAD
2021-08-31 15:57:48 +02:00
parent 3b1583a08d
commit 5eac7dd356
12 changed files with 100 additions and 8 deletions

View File

@@ -16,6 +16,13 @@ namespace Flowframes.Main
{
string pkgPath = Path.Combine(Paths.GetPkgPath(), ai.pkgDir);
string modelsFile = Path.Combine(pkgPath, "models.json");
if (!File.Exists(modelsFile))
{
Logger.Log($"Error: File models.json is missing for {ai.aiName}, can't load AI models for this implementation!");
return new ModelCollection(ai);
}
ModelCollection modelCollection = new ModelCollection(ai, modelsFile);
foreach (string customModel in GetCustomModels(ai))

View File

@@ -37,7 +37,7 @@ namespace Flowframes
Program.initialRun = false;
Program.mainForm.SetWorking(true);
if (!Utils.InputIsValid(current.inPath, current.outPath, current.outFps, current.interpFactor, current.outMode)) return; // General input checks
if (!Utils.CheckAiAvailable(current.ai)) return; // Check if selected AI pkg is installed
if (!Utils.CheckAiAvailable(current.ai, current.model)) return; // Check if selected AI pkg is installed
if (!ResumeUtils.resumeNextRun && !Utils.CheckDeleteOldTempFolder()) return; // Try to delete temp folder if an old one exists
if (!Utils.CheckPathValid(current.inPath)) return; // Check if input path/file is valid
if (!(await Utils.CheckEncoderValid())) return; // Check NVENC compat

View File

@@ -69,7 +69,7 @@ namespace Flowframes.Main
public static async Task InterpolateStep()
{
if (!InterpolateUtils.CheckAiAvailable(current.ai)) return;
if (!InterpolateUtils.CheckAiAvailable(current.ai, current.model)) return;
current.framesFolder = Path.Combine(current.tempFolder, Paths.framesDir);

View File

@@ -138,7 +138,7 @@ namespace Flowframes.Main
}
}
public static bool CheckAiAvailable(AI ai)
public static bool CheckAiAvailable(AI ai, ModelCollection.ModelInfo model)
{
if (IoUtils.GetAmountOfFiles(Path.Combine(Paths.GetPkgPath(), ai.pkgDir), true) < 1)
{
@@ -147,6 +147,13 @@ namespace Flowframes.Main
return false;
}
if (model == null || model.dir.Trim() == "")
{
ShowMessage("No valid AI model has been selected!", "Error");
I.Cancel("No valid model selected.", true);
return false;
}
if (I.current.ai.aiName.ToUpper().Contains("CUDA") && NvApi.gpuList.Count < 1)
{
ShowMessage("Warning: No Nvidia GPU was detected. CUDA might fall back to CPU!\n\nTry an NCNN implementation instead if you don't have an Nvidia GPU.", "Error");