Skip to content

Commit b3eb9f9

Browse files
authored
Merge pull request LykosAI#897 from ionite34/downmerge-public-stuff
Downmerge public stuff
2 parents b2dd612 + ac468c7 commit b3eb9f9

File tree

7 files changed

+206
-20
lines changed

7 files changed

+206
-20
lines changed

.github/workflows/stale.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ jobs:
1515
steps:
1616
- uses: actions/stale@v9
1717
with:
18-
stale-issue-message: 'This issue is pending because it has been awaiting a response for 14 days with no activity. Remove the pending label or comment, else this will be closed in 5 days.'
19-
close-issue-message: 'This issue was closed because it has been pending for 5 days with no activity.'
18+
stale-issue-message: 'This issue is pending because it has been awaiting a response for 30 days with no activity. Remove the pending label or comment, else this will be closed in 7 days.'
19+
close-issue-message: 'This issue was closed because it has been pending for 7 days with no activity.'
2020
only-labels: 'awaiting-feedback'
2121
stale-issue-label: 'pending'
22-
exempt-issue-labels: 'planned,milestone,work-in-progress'
23-
days-before-issue-stale: 14
24-
days-before-issue-close: 5
22+
exempt-issue-labels: 'planned,milestone,work-in-progress,enhancement,crash'
23+
days-before-issue-stale: 30
24+
days-before-issue-close: 7
2525
days-before-pr-close: -1
2626
days-before-pr-stale: -1
2727
operations-per-run: 45
2828

2929
- uses: actions/stale@v9
3030
with:
31-
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove the stale label or comment, else this will be closed in 5 days.'
32-
close-issue-message: 'This issue was closed because it has been stale for 5 days with no activity.'
31+
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove the stale label or comment, else this will be closed in 7 days.'
32+
close-issue-message: 'This issue was closed because it has been stale for 7 days with no activity.'
3333
stale-issue-label: 'stale'
34-
exempt-issue-labels: 'planned,milestone,work-in-progress'
35-
days-before-issue-stale: 30
36-
days-before-issue-close: 5
34+
exempt-issue-labels: 'planned,milestone,work-in-progress,enhancement,crash'
35+
days-before-issue-stale: 60
36+
days-before-issue-close: 7
3737
days-before-pr-close: -1
3838
days-before-pr-stale: -1
3939
operations-per-run: 45

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
3232
- Fixed error when installing Automatic1111 on macOS
3333
- Fixed some instances of Civitai model browser not loading new results
3434
- Fixed "Unsupported Torch Version: Cuda" errors when installing a1111
35+
### Supporters
36+
#### Visionaries
37+
- A huge shout-out to our dedicated Visionary-tier Patreon supporter, **Waterclouds**! Your unwavering support is greatly appreciated!
38+
#### Pioneers
39+
- We'd also like to express our gratitude to our amazing Pioneer-tier patrons: **tankfox**, **tanangular**, **Mr. Unknown**, and **Szir777**! Your ongoing support means a great deal!
3540

3641
## v2.12.2
3742
### Added

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
[sdfx]: https://github.com/sdfxai/sdfx
3232
[fooocus-mashb1t]: https://github.com/mashb1t/Fooocus
3333
[reforge]: https://github.com/Panchovix/stable-diffusion-webui-reForge
34+
[simplesdxl]: https://github.com/metercai/SimpleSDXL/
35+
[fluxgym]: https://github.com/cocktailpeanut/fluxgym
36+
[cogvideo]: https://github.com/THUDM/CogVideo
37+
[cogstudio]: https://github.com/pinokiofactory/cogstudio
3438

3539
[civitai]: https://civitai.com/
3640
[huggingface]: https://huggingface.co/
@@ -47,15 +51,16 @@ Multi-Platform Package Manager and Inference UI for Stable Diffusion
4751
### 🖱️ One click install and update for Stable Diffusion Web UI Packages
4852
- Supports:
4953
- [Stable Diffusion WebUI reForge][reforge], [Stable Diffusion WebUI Forge][forge], [Automatic 1111][auto1111], [Automatic 1111 DirectML][auto1111-directml], [SD Web UI-UX][webui-ux], [SD.Next][sdnext]
50-
- [Fooocus][fooocus], [Fooocus MRE][fooocus-mre], [Fooocus ControlNet SDXL][fooocus-controlnet], [Ruined Fooocus][ruined-fooocus], [Fooocus - mashb1t's 1-Up Edition][fooocus-mashb1t], [SimpleSDXL](https://github.com/metercai/SimpleSDXL/)
54+
- [Fooocus][fooocus], [Fooocus MRE][fooocus-mre], [Fooocus ControlNet SDXL][fooocus-controlnet], [Ruined Fooocus][ruined-fooocus], [Fooocus - mashb1t's 1-Up Edition][fooocus-mashb1t], [SimpleSDXL][simplesdxl]
5155
- [ComfyUI][comfy]
5256
- [StableSwarmUI][stable-swarm]
5357
- [VoltaML][voltaml]
5458
- [InvokeAI][invokeai]
5559
- [SDFX][sdfx]
5660
- [Kohya's GUI][kohya-ss]
5761
- [OneTrainer][onetrainer]
58-
- [FluxGym](https://github.com/cocktailpeanut/fluxgym)
62+
- [FluxGym][fluxgym]
63+
- [CogVideo][cogvideo] via [CogStudio][cogstudio]
5964
- Manage plugins / extensions for supported packages ([Automatic1111][auto1111], [Comfy UI][comfy], [SD Web UI-UX][webui-ux], and [SD.Next][sdnext])
6065
- Easily install or update Python dependencies for each package
6166
- Embedded Git and Python dependencies, with no need for either to be globally installed

StabilityMatrix.Core/Helper/Factory/PackageFactory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ public BasePackage GetNewBasePackage(InstalledPackage installedPackage)
9292
"FluxGym" => new FluxGym(githubApiCache, settingsManager, downloadService, prerequisiteHelper),
9393
"SimpleSDXL"
9494
=> new SimpleSDXL(githubApiCache, settingsManager, downloadService, prerequisiteHelper),
95+
"Cogstudio"
96+
=> new Cogstudio(githubApiCache, settingsManager, downloadService, prerequisiteHelper),
9597
_ => throw new ArgumentOutOfRangeException(nameof(installedPackage))
9698
};
9799
}
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
using System.Text.RegularExpressions;
2+
using StabilityMatrix.Core.Attributes;
3+
using StabilityMatrix.Core.Helper;
4+
using StabilityMatrix.Core.Helper.Cache;
5+
using StabilityMatrix.Core.Models.FileInterfaces;
6+
using StabilityMatrix.Core.Models.Progress;
7+
using StabilityMatrix.Core.Processes;
8+
using StabilityMatrix.Core.Python;
9+
using StabilityMatrix.Core.Services;
10+
11+
namespace StabilityMatrix.Core.Models.Packages;
12+
13+
[Singleton(typeof(BasePackage))]
14+
public class Cogstudio(
15+
IGithubApiCache githubApi,
16+
ISettingsManager settingsManager,
17+
IDownloadService downloadService,
18+
IPrerequisiteHelper prerequisiteHelper
19+
)
20+
: BaseGitPackage(githubApi, settingsManager, downloadService, prerequisiteHelper),
21+
ISharedFolderLayoutPackage
22+
{
23+
public override string Name => "Cogstudio";
24+
public override string DisplayName { get; set; } = "Cogstudio";
25+
public override string RepositoryName => "CogVideo";
26+
public override string RepositoryAuthor => "THUDM";
27+
public override string Author => "pinokiofactory";
28+
public override string Blurb =>
29+
"An advanced gradio web ui for generating and editing videos with CogVideo.";
30+
public override string LicenseType => "Apache-2.0";
31+
public override string LicenseUrl => "https://github.com/THUDM/CogVideo/blob/main/LICENSE";
32+
public override string LaunchCommand => "inference/gradio_composite_demo/cogstudio.py";
33+
public override Uri PreviewImageUri =>
34+
new("https://raw.githubusercontent.com/pinokiofactory/cogstudio/main/img2vid.gif");
35+
public override List<LaunchOptionDefinition> LaunchOptions => new() { LaunchOptionDefinition.Extras };
36+
public override SharedFolderMethod RecommendedSharedFolderMethod => SharedFolderMethod.None;
37+
public override IEnumerable<SharedFolderMethod> AvailableSharedFolderMethods =>
38+
new[] { SharedFolderMethod.None };
39+
public override Dictionary<SharedFolderType, IReadOnlyList<string>> SharedFolders =>
40+
((ISharedFolderLayoutPackage)this).LegacySharedFolders;
41+
public virtual SharedFolderLayout SharedFolderLayout => new();
42+
public override Dictionary<SharedOutputType, IReadOnlyList<string>> SharedOutputFolders =>
43+
new() { [SharedOutputType.Text2Vid] = new[] { "output" } };
44+
public override IEnumerable<TorchIndex> AvailableTorchIndices =>
45+
new[] { TorchIndex.Cpu, TorchIndex.Cuda };
46+
public override string MainBranch => "main";
47+
public override bool ShouldIgnoreReleases => true;
48+
public override string OutputFolderName => "output";
49+
public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Simple;
50+
51+
public override async Task InstallPackage(
52+
string installLocation,
53+
InstalledPackage installedPackage,
54+
InstallPackageOptions options,
55+
IProgress<ProgressReport>? progress = null,
56+
Action<ProcessOutput>? onConsoleOutput = null,
57+
CancellationToken cancellationToken = default
58+
)
59+
{
60+
const string cogstudioUrl =
61+
"https://raw.githubusercontent.com/pinokiofactory/cogstudio/refs/heads/main/cogstudio.py";
62+
63+
progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true));
64+
await using var venvRunner = await SetupVenvPure(installLocation).ConfigureAwait(false);
65+
66+
progress?.Report(new ProgressReport(-1f, "Setting up Cogstudio files", isIndeterminate: true));
67+
var gradioCompositeDemo = new FilePath(installLocation, "inference/gradio_composite_demo");
68+
var cogstudioFile = new FilePath(gradioCompositeDemo, "cogstudio.py");
69+
gradioCompositeDemo.Directory?.Create();
70+
await DownloadService
71+
.DownloadToFileAsync(cogstudioUrl, cogstudioFile, cancellationToken: cancellationToken)
72+
.ConfigureAwait(false);
73+
74+
progress?.Report(
75+
new ProgressReport(
76+
-1f,
77+
"Patching cogstudio.py to allow writing to the output folder",
78+
isIndeterminate: true
79+
)
80+
);
81+
var outputDir = new FilePath(installLocation, "output");
82+
if (Compat.IsWindows)
83+
{
84+
outputDir = outputDir.ToString().Replace("\\", "\\\\");
85+
}
86+
var cogstudioContent = await cogstudioFile.ReadAllTextAsync(cancellationToken).ConfigureAwait(false);
87+
cogstudioContent = cogstudioContent.Replace(
88+
"demo.launch()",
89+
$"demo.launch(allowed_paths=['{outputDir}'])"
90+
);
91+
await cogstudioFile.WriteAllTextAsync(cogstudioContent, cancellationToken).ConfigureAwait(false);
92+
93+
progress?.Report(new ProgressReport(-1f, "Installing requirements", isIndeterminate: true));
94+
var requirements = new FilePath(installLocation, "requirements.txt");
95+
var pipArgs = new PipInstallArgs()
96+
.WithTorch("==2.3.1")
97+
.WithTorchVision("==0.18.1")
98+
.WithTorchAudio("==2.3.1")
99+
.WithTorchExtraIndex("cu121")
100+
.WithParsedFromRequirementsTxt(
101+
await requirements.ReadAllTextAsync(cancellationToken).ConfigureAwait(false),
102+
excludePattern: Compat.IsWindows
103+
? "torch.*|moviepy.*|SwissArmyTransformer.*"
104+
: "torch.*|moviepy.*"
105+
);
106+
107+
if (installedPackage.PipOverrides != null)
108+
{
109+
pipArgs = pipArgs.WithUserOverrides(installedPackage.PipOverrides);
110+
}
111+
112+
// SwissArmyTransformer is not available on Windows and DeepSpeed needs prebuilt wheels
113+
if (Compat.IsWindows)
114+
{
115+
await venvRunner
116+
.PipInstall(
117+
" https://github.com/daswer123/deepspeed-windows/releases/download/11.2/deepspeed-0.11.2+cuda121-cp310-cp310-win_amd64.whl",
118+
onConsoleOutput
119+
)
120+
.ConfigureAwait(false);
121+
await venvRunner
122+
.PipInstall("spandrel opencv-python scikit-video", onConsoleOutput)
123+
.ConfigureAwait(false);
124+
}
125+
126+
await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false);
127+
await venvRunner.PipInstall("moviepy==2.0.0.dev2", onConsoleOutput).ConfigureAwait(false);
128+
}
129+
130+
public override async Task RunPackage(
131+
string installLocation,
132+
InstalledPackage installedPackage,
133+
RunPackageOptions options,
134+
Action<ProcessOutput>? onConsoleOutput = null,
135+
CancellationToken cancellationToken = default
136+
)
137+
{
138+
await SetupVenv(installLocation).ConfigureAwait(false);
139+
140+
void HandleConsoleOutput(ProcessOutput s)
141+
{
142+
onConsoleOutput?.Invoke(s);
143+
144+
if (s.Text.Contains("Running on local URL", StringComparison.OrdinalIgnoreCase))
145+
{
146+
var regex = new Regex(@"(https?:\/\/)([^:\s]+):(\d+)");
147+
var match = regex.Match(s.Text);
148+
149+
if (match.Success)
150+
{
151+
WebUrl = match.Value;
152+
}
153+
OnStartupComplete(WebUrl);
154+
}
155+
}
156+
157+
VenvRunner.RunDetached(
158+
[Path.Combine(installLocation, options.Command ?? LaunchCommand), ..options.Arguments],
159+
HandleConsoleOutput,
160+
OnExit
161+
);
162+
}
163+
}

StabilityMatrix.Core/Models/Packages/FluxGym.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,24 @@ public override async Task InstallPackage(
8585
CancellationToken cancellationToken = default
8686
)
8787
{
88-
progress?.Report(new ProgressReport(-1f, "Cloning sd-scripts", isIndeterminate: true));
89-
await prerequisiteHelper
90-
.RunGit(
91-
["clone", "-b", "sd3", "https://github.com/kohya-ss/sd-scripts"],
92-
onConsoleOutput,
93-
installLocation
94-
)
95-
.ConfigureAwait(false);
88+
progress?.Report(new ProgressReport(-1f, "Cloning / updating sd-scripts", isIndeterminate: true));
89+
// check if sd-scripts is already installed - if so: pull, else: clone
90+
if (Directory.Exists(Path.Combine(installLocation, "sd-scripts")))
91+
{
92+
await prerequisiteHelper
93+
.RunGit(["pull"], onConsoleOutput, Path.Combine(installLocation, "sd-scripts"))
94+
.ConfigureAwait(false);
95+
}
96+
else
97+
{
98+
await prerequisiteHelper
99+
.RunGit(
100+
["clone", "-b", "sd3", "https://github.com/kohya-ss/sd-scripts"],
101+
onConsoleOutput,
102+
installLocation
103+
)
104+
.ConfigureAwait(false);
105+
}
96106

97107
progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true));
98108
await using var venvRunner = await SetupVenvPure(installLocation).ConfigureAwait(false);

StabilityMatrix.Core/Models/SharedOutputType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public enum SharedOutputType
44
{
55
All,
66
Text2Img,
7+
Text2Vid,
78
Img2Img,
89
Extras,
910
Text2ImgGrids,

0 commit comments

Comments
 (0)