public static async Task RunAi(string outpath, AI ai, bool stepByStep = false) { Program.mainForm.SetStatus("Downloading models..."); await ModelDownloader.DownloadModelFiles(ai.pkgDir, current.model); if (canceled) { return; } currentlyUsingAutoEnc = Utils.CanUseAutoEnc(stepByStep, current); IOUtils.CreateDir(outpath); List <Task> tasks = new List <Task>(); if (ai.aiName == Networks.rifeCuda.aiName) { tasks.Add(AiProcess.RunRifeCuda(current.framesFolder, current.interpFactor, current.model)); } if (ai.aiName == Networks.rifeNcnn.aiName) { tasks.Add(AiProcess.RunRifeNcnn(current.framesFolder, outpath, (int)current.interpFactor, current.model)); } if (ai.aiName == Networks.flavrCuda.aiName) { tasks.Add(AiProcess.RunFlavrCuda(current.framesFolder, current.interpFactor, current.model)); } if (ai.aiName == Networks.dainNcnn.aiName) { tasks.Add(AiProcess.RunDainNcnn(current.framesFolder, outpath, current.interpFactor, current.model, Config.GetInt("dainNcnnTilesize", 512))); } if (currentlyUsingAutoEnc) { Logger.Log($"{Logger.GetLastLine()} (Using Auto-Encode)", true); tasks.Add(AutoEncode.MainLoop(outpath)); } Program.mainForm.SetStatus("Running AI..."); await Task.WhenAll(tasks); }
public async Task CheckModelCacheSize() { long modelFoldersBytes = 0; foreach (string modelFolder in ModelDownloader.GetAllModelFolders()) { modelFoldersBytes += IOUtils.GetDirSize(modelFolder, true); } if (modelFoldersBytes > 1024 * 1024) { clearModelCacheBtn.Text = $"Clear Model Cache ({FormatUtils.Bytes(modelFoldersBytes)})"; } else { clearModelCacheBtn.Enabled = false; } }
public static async Task DownloadForAi(AI ai) { ModelCollection modelCollection = AiModels.GetModels(ai); for (int i = 0; i < modelCollection.models.Count; i++) { if (canceled) { return; } ModelCollection.ModelInfo modelInfo = modelCollection.models[i]; form.SetStatus($"Downloading files for {modelInfo.ai.aiName.Replace("_", "-")}..."); await ModelDownloader.DownloadModelFiles(ai, modelInfo.dir, false); taskCounter++; UpdateProgressBar(); } }
void Start() { //Directory.CreateDirectory(Application.streamingAssetsPath + "/Test"); modelManager = ModelManager.Instance; rotationManager = RotationManager.Instance; positionManager = PositionManager.Instance; scaleManager = ScaleManager.Instance; modelManager.SetModels(ModelDownloader.DownloadModels(inputDirectoryPath, startPoint, parentOfmodels, defaultMaterial)); if (clearOutputFolder) { ScreenshotUploader.ClearFolder(outputDirectoryPath); } ModelObject modelObj = modelManager.GetCurrentModelObject(); rotationManager.SetCurrentModel(modelObj.gameObject); positionManager.SetCurrentModel(modelObj.gameObject); scaleManager.SetCurrentModel(modelObj.gameObject); }
private void clearModelCacheBtn_Click(object sender, EventArgs e) { ModelDownloader.DeleteAllModels(); clearModelCacheBtn.Text = "Clear Model Cache"; CheckModelCacheSize(); }
public static async Task RunAi(string outpath, AI ai, bool stepByStep = false) { if (canceled) { return; } await Task.Run(async() => { await Dedupe.CreateDupesFile(current.framesFolder, currentInputFrameCount, current.framesExt); }); await Task.Run(async() => { await FrameRename.Rename(); }); await Task.Run(async() => { await FrameOrder.CreateFrameOrderFile(current.framesFolder, Config.GetBool(Config.Key.enableLoop), current.interpFactor); }); Program.mainForm.SetStatus("Downloading models..."); await ModelDownloader.DownloadModelFiles(ai, current.model.dir); if (canceled) { return; } currentlyUsingAutoEnc = Utils.CanUseAutoEnc(stepByStep, current); IoUtils.CreateDir(outpath); List <Task> tasks = new List <Task>(); if (ai.aiName == Implementations.rifeCuda.aiName) { tasks.Add(AiProcess.RunRifeCuda(current.framesFolder, current.interpFactor, current.model.dir)); } if (ai.aiName == Implementations.rifeNcnn.aiName) { tasks.Add(AiProcess.RunRifeNcnn(current.framesFolder, outpath, current.interpFactor, current.model.dir)); } if (ai.aiName == Implementations.flavrCuda.aiName) { tasks.Add(AiProcess.RunFlavrCuda(current.framesFolder, current.interpFactor, current.model.dir)); } if (ai.aiName == Implementations.dainNcnn.aiName) { tasks.Add(AiProcess.RunDainNcnn(current.framesFolder, outpath, current.interpFactor, current.model.dir, Config.GetInt(Config.Key.dainNcnnTilesize, 512))); } if (ai.aiName == Implementations.xvfiCuda.aiName) { tasks.Add(AiProcess.RunXvfiCuda(current.framesFolder, current.interpFactor, current.model.dir)); } if (currentlyUsingAutoEnc) { Logger.Log($"{Logger.GetLastLine()} (Using Auto-Encode)", true); tasks.Add(AutoEncode.MainLoop(outpath)); } Program.mainForm.SetStatus("Running AI..."); await Task.WhenAll(tasks); }
private static void DownloadDefinitions(Options options) { var model = new ModelDownloader(options.OctopusUrl, options.OctopusApiKey).DownloadModel(); new YamlSystemModelRepository().Save(model, options.DefinitionsDir); }
public void SetUp() { _repository = new FakeOctopusRepository(); _downloader = new ModelDownloader(_repository, new NullLoggerFactory()); _uploader = new ModelUploader(_repository, new NullLoggerFactory()); }
public void SetUp() { _repository = new FakeOctopusRepository(); _downloader = new ModelDownloader(_repository); _uploader = new ModelUploader(_repository); }