Model Downloader: Copy NCNN models to NCNN-VS, NCNN: Clamp compute queues

This commit is contained in:
N00MKRAD
2024-10-15 16:45:49 +02:00
parent 7e0182f007
commit 835ec0277f
4 changed files with 21 additions and 12 deletions

View File

@@ -92,11 +92,6 @@ namespace Flowframes.Forms.Main
HandleArgs();
Initialized();
if (ShowModelDownloader)
{
new ModelDownloadForm().ShowDialog();
}
if (Debugger.IsAttached)
{
Logger.Log("Debugger is attached.");
@@ -461,12 +456,17 @@ namespace Flowframes.Forms.Main
{
Application.OpenForms.OfType<SplashForm>().ToList().ForEach(f => f.Close());
if (!Program.CmdMode)
Opacity = 1.0f;
_initialized = true;
runBtn.Enabled = true;
SetStatus("Ready");
if (ShowModelDownloader)
{
new ModelDownloadForm().ShowDialog();
}
if (!Program.CmdMode)
Opacity = 1.0f;
}
private void browseInputBtn_Click(object sender, EventArgs e)

View File

@@ -175,7 +175,18 @@ namespace Flowframes.IO
Logger.Log($"Downloaded \"{modelDir}\" model files.", !log, true);
if (!(await AreFilesValid(aiDir, modelDir)))
{
Interpolate.Cancel($"Model files are invalid! Please try again.");
return;
}
if (ai.NameInternal == Implementations.rifeNcnn.NameInternal)
{
string modelPath = Path.Combine(Paths.GetPkgPath(), Implementations.rifeNcnn.PkgDir, modelDir);
string ncnnModelPath = Path.Combine(Paths.GetPkgPath(), Implementations.rifeNcnnVs.PkgDir, modelDir);
Logger.Log($"Copying {modelPath} to {ncnnModelPath}", true);
IoUtils.CopyDir(modelPath, ncnnModelPath);
}
}
catch (Exception e)
{

View File

@@ -43,7 +43,7 @@ namespace Flowframes.Os
string name = device.GetProperties().DeviceName;
VkDevices.Add(new VkDevice { Id = idx, Name = name, ComputeQueueCount = compQueues });
Logger.Log($"[VK] Found Vulkan device: {VkDevices.Last()}", true);
Logger.Log($"[VK] Found Vulkan device: {VkDevices.Last()} ({compQueues} Compute Queues)", true);
}
// Clean up Vulkan resources

View File

@@ -4,9 +4,7 @@ using Flowframes.Main;
using Flowframes.Os;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -17,7 +15,7 @@ namespace Flowframes.Utilities
public static int GetRifeNcnnGpuThreads(Size res, int gpuId, AiInfo ai)
{
int threads = Config.GetInt(Config.Key.ncnnThreads);
int maxThreads = VulkanUtils.GetMaxNcnnThreads(gpuId);
int maxThreads = VulkanUtils.GetMaxNcnnThreads(gpuId).Clamp(1, 64);
threads = threads.Clamp(1, maxThreads); // To avoid exceeding the max queue count
Logger.Log($"Using {threads}/{maxThreads} GPU compute threads.", true, false, ai.LogFilename);