From 07610da00d2e166f2cc40e42dda765199273d16e Mon Sep 17 00:00:00 2001 From: JT Date: Thu, 16 Nov 2023 20:17:56 -0800 Subject: [PATCH] fix invokeAI torch/cuda check so we don't reinstall torch every update --- StabilityMatrix.Core/Models/Packages/InvokeAI.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/StabilityMatrix.Core/Models/Packages/InvokeAI.cs b/StabilityMatrix.Core/Models/Packages/InvokeAI.cs index 1d2c9b0c..8840f8b9 100644 --- a/StabilityMatrix.Core/Models/Packages/InvokeAI.cs +++ b/StabilityMatrix.Core/Models/Packages/InvokeAI.cs @@ -218,8 +218,15 @@ public class InvokeAI : BaseGitPackage var args = new List(); if (exists) { - args.Add("--upgrade"); - args.Add("--force-reinstall"); + var pipPackages = await venvRunner.PipList().ConfigureAwait(false); + var hasCuda121 = pipPackages.Any( + p => p.Name == "torch" && p.Version.Contains("cu121") + ); + if (!hasCuda121) + { + args.Add("--upgrade"); + args.Add("--force-reinstall"); + } } await venvRunner