Skip to content

Commit ef2c3ab

Browse files
authored
Merge pull request #344 from ionite34/always-update-torch
Always update torch
2 parents da399bc + d553069 commit ef2c3ab

File tree

2 files changed

+31
-59
lines changed

2 files changed

+31
-59
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
[civitai]: https://civitai.com/
2020

21-
Multi-Platform Package Manager for Stable Diffusion
21+
Multi-Platform Package Manager and Inference UI for Stable Diffusion
2222

23-
### ✨ New in 2.5 - [Inference](#inference), a built-in Stable Diffusion interface powered by ComfyUI
23+
### ✨ New in 2.5 - [Inference](#inference-A-reimagined-built-in-Stable-Diffusion-experience), a built-in interface for Stable Diffusion powered by ComfyUI
2424

2525
### 🖱️ One click install and update for Stable Diffusion Web UI Packages
2626
- Supports [Automatic 1111][auto1111], [Comfy UI][comfy], [SD.Next (Vladmandic)][sdnext], [VoltaML][voltaml], [InvokeAI][invokeai], [Fooocus][fooocus], and [Fooocus MRE][fooocus-mre]
@@ -107,6 +107,9 @@ Stability Matrix is now available in the following languages, thanks to our comm
107107

108108
If you would like to contribute a translation, please create an issue or contact us on Discord. Include an email where we'll send an invite to our [POEditor](https://poeditor.com/) project.
109109

110+
## Disclaimers
111+
All trademarks, logos, and brand names are the property of their respective owners. All company, product and service names used in this document and licensed applications are for identification purposes only. Use of these names, trademarks, and brands does not imply endorsement.
112+
110113
## License
111114

112115
This repository maintains the latest source code release for Stability Matrix, and is licensed under the [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html). Binaries and executable releases are licensed under the [End User License Agreement](https://lykos.ai/license).

StabilityMatrix.Core/Models/Packages/InvokeAI.cs

+26-57
Original file line numberDiff line numberDiff line change
@@ -188,73 +188,42 @@ public override async Task InstallPackage(
188188
var pipCommandArgs =
189189
"-e . --use-pep517 --extra-index-url https://download.pytorch.org/whl/cpu";
190190

191-
var installTorch21 = versionOptions.IsLatest;
192-
193-
if (!string.IsNullOrWhiteSpace(versionOptions.VersionTag) && !versionOptions.IsLatest)
194-
{
195-
if (
196-
Version.TryParse(versionOptions.VersionTag, out var version)
197-
&& version >= new Version(3, 4)
198-
)
199-
{
200-
installTorch21 = true;
201-
}
202-
}
203-
204191
switch (torchVersion)
205192
{
206193
// If has Nvidia Gpu, install CUDA version
207194
case TorchVersion.Cuda:
208-
if (installTorch21)
195+
progress?.Report(
196+
new ProgressReport(-1f, "Installing PyTorch for CUDA", isIndeterminate: true)
197+
);
198+
199+
var args = new List<Argument>();
200+
if (exists)
209201
{
210-
progress?.Report(
211-
new ProgressReport(
212-
-1f,
213-
"Installing PyTorch for CUDA",
214-
isIndeterminate: true
215-
)
202+
var pipPackages = await venvRunner.PipList().ConfigureAwait(false);
203+
var hasCuda121 = pipPackages.Any(
204+
p => p.Name == "torch" && p.Version.Contains("cu121")
216205
);
217-
218-
var args = new List<Argument>();
219-
if (exists)
206+
if (!hasCuda121)
220207
{
221-
var pipPackages = await venvRunner.PipList().ConfigureAwait(false);
222-
var hasCuda121 = pipPackages.Any(
223-
p => p.Name == "torch" && p.Version.Contains("cu121")
224-
);
225-
if (!hasCuda121)
226-
{
227-
args.Add("--upgrade");
228-
args.Add("--force-reinstall");
229-
}
208+
args.Add("--upgrade");
209+
args.Add("--force-reinstall");
230210
}
231-
232-
await venvRunner
233-
.PipInstall(
234-
new PipInstallArgs(
235-
args.Any() ? args.ToArray() : Array.Empty<Argument>()
236-
)
237-
.WithTorch("==2.1.0")
238-
.WithTorchVision("==0.16.0")
239-
.WithXFormers("==0.0.22post7")
240-
.WithTorchExtraIndex("cu121"),
241-
onConsoleOutput
242-
)
243-
.ConfigureAwait(false);
244-
245-
Logger.Info("Starting InvokeAI install (CUDA)...");
246-
pipCommandArgs =
247-
"-e .[xformers] --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121";
248-
}
249-
else
250-
{
251-
await InstallCudaTorch(venvRunner, progress, onConsoleOutput)
252-
.ConfigureAwait(false);
253-
Logger.Info("Starting InvokeAI install (CUDA)...");
254-
pipCommandArgs =
255-
"-e .[xformers] --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu118";
256211
}
257212

213+
await venvRunner
214+
.PipInstall(
215+
new PipInstallArgs(args.Any() ? args.ToArray() : Array.Empty<Argument>())
216+
.WithTorch("==2.1.0")
217+
.WithTorchVision("==0.16.0")
218+
.WithXFormers("==0.0.22post7")
219+
.WithTorchExtraIndex("cu121"),
220+
onConsoleOutput
221+
)
222+
.ConfigureAwait(false);
223+
224+
Logger.Info("Starting InvokeAI install (CUDA)...");
225+
pipCommandArgs =
226+
"-e .[xformers] --use-pep517 --extra-index-url https://download.pytorch.org/whl/cu121";
258227
break;
259228
// For AMD, Install ROCm version
260229
case TorchVersion.Rocm:

0 commit comments

Comments
 (0)