From 1e966eee5357f2690ceb6f4acff4b608c8e29371 Mon Sep 17 00:00:00 2001 From: Maiko Sinkyaet Tan Date: Thu, 15 Aug 2024 23:45:34 +0800 Subject: [PATCH 1/4] ci: upgrade github actions version (#259) --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7436782..1538c66 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,11 +10,9 @@ jobs: steps: - name: Check out - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18 + uses: actions/setup-node@v4 - name: Install run: yarn - name: Build From 97f8e17b040a9c953a50e05d60abcfa61aa07f2b Mon Sep 17 00:00:00 2001 From: Maiko Sinkyaet Tan Date: Thu, 15 Aug 2024 23:48:38 +0800 Subject: [PATCH 2/4] feat: update stable horde models (#257) --- data/horde-models.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/horde-models.json b/data/horde-models.json index bd0a1ee..23372f6 100644 --- a/data/horde-models.json +++ b/data/horde-models.json @@ -8,6 +8,7 @@ "ACertainThing", "AIO Pixel Art", "AlbedoBase XL (SDXL)", + "AMPonyXL", "Analog Diffusion", "Analog Madness", "Animagine XL", @@ -25,6 +26,8 @@ "A-Zovya RPG Inpainting", "Babes", "BB95 Furry Mix", + "BB95 Furry Mix v14", + "Blank Canvas XL", "BPModel", "BRA", "BweshMix", @@ -165,8 +168,8 @@ "stable_diffusion", "stable_diffusion_2.1", "stable_diffusion_inpainting", + "SwamPonyXL", "SweetBoys 2D", - "ThisIsReal (V6.0)", "ToonYou", "Trinart Characters", "Tron Legacy Diffusion", From 5774d03910dc9b14e0658f0ab0496bec91634362 Mon Sep 17 00:00:00 2001 From: Maiko Sinkyaet Tan Date: Fri, 16 Aug 2024 00:16:58 +0800 Subject: [PATCH 3/4] fix: configs for nai-v3 model not showing (#258) --- src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index 40aaf0c..3355c41 100644 --- a/src/config.ts +++ b/src/config.ts @@ -370,7 +370,7 @@ export const Config = Schema.intersect([ }), Schema.union([ Schema.object({ - model: Schema.const('nai-v3').required(), + model: Schema.const('nai-v3'), sampler: sampler.createSchema(sampler.nai3), smea: Schema.boolean().description('默认启用 SMEA。'), smeaDyn: Schema.boolean().description('默认启用 SMEA 采样器的 DYN 变体。'), From 67449958d8001a0f073ca4d88da3c09d81eeca0a Mon Sep 17 00:00:00 2001 From: Maiko Sinkyaet Tan Date: Fri, 16 Aug 2024 00:17:42 +0800 Subject: [PATCH 4/4] feat: add upscaler for hires fix (#260) --- src/config.ts | 11 +++++++++++ src/index.ts | 9 +++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/config.ts b/src/config.ts index 3355c41..fc7856b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -137,6 +137,15 @@ export const upscalers = [ 'SwinIR 4x', ] as const +export const latentUpscalers = [ + 'Latent', + 'Latent (antialiased)', + 'Latent (bicubic)', + 'Latent (bicubic antialiased)', + 'Latent (nearest)', + 'Latent (nearest-exact)', +] + export interface Options { enhance: boolean model: string @@ -208,6 +217,7 @@ interface ParamConfig { upscaler?: string restoreFaces?: boolean hiresFix?: boolean + hiresFixUpscaler: string scale?: Computed textSteps?: Computed imageSteps?: Computed @@ -338,6 +348,7 @@ export const Config = Schema.intersect([ upscaler: Schema.union(upscalers).description('默认的放大算法。').default('Lanczos'), restoreFaces: Schema.boolean().description('是否启用人脸修复。').default(false), hiresFix: Schema.boolean().description('是否启用高分辨率修复。').default(false), + hiresFixUpscaler: Schema.union(latentUpscalers.concat(upscalers)).description('高分辨率修复的放大算法。').default('Latent'), scheduler: Schema.union(scheduler.sd).description('默认的调度器。').default('Automatic'), }), Schema.object({ diff --git a/src/index.ts b/src/index.ts index 101f0ac..5b002fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -365,6 +365,7 @@ export function apply(ctx: Context, config: Config) { init_images: image && [image.dataUrl], // sd-webui accepts data URLs with base64 encoded image restore_faces: config.restoreFaces ?? false, enable_hr: options.hiresFix ?? config.hiresFix ?? false, + hr_upscaler: config.hiresFixUpscaler ?? 'None', ...project(parameters, { prompt: 'prompt', batch_size: 'n_samples', @@ -418,8 +419,8 @@ export function apply(ctx: Context, config: Config) { const body = new FormData() const capture = /^data:([\w/.+-]+);base64,(.*)$/.exec(image.dataUrl) const [, mime,] = capture - - let name = Date.now().toString() + + let name = Date.now().toString() const ext = mime === 'image/jpeg' ? 'jpg' : mime === 'image/png' ? 'png' : '' if (ext) name += `.${ext}` const imageFile = new Blob([image.buffer], {type:mime}) @@ -435,7 +436,7 @@ export function apply(ctx: Context, config: Config) { const data = res.data let imagePath = data.name if (data.subfolder) imagePath = data.subfolder + '/' + imagePath - + for (const nodeId in prompt) { if (prompt[nodeId].class_type === 'LoadImage') { prompt[nodeId].inputs.image = imagePath @@ -460,7 +461,7 @@ export function apply(ctx: Context, config: Config) { const negativeeNodeId = prompt[nodeId].inputs.negative[0] const latentImageNodeId = prompt[nodeId].inputs.latent_image[0] prompt[positiveNodeId].inputs.text = parameters.prompt - prompt[negativeeNodeId].inputs.text = parameters.uc + prompt[negativeeNodeId].inputs.text = parameters.uc prompt[latentImageNodeId].inputs.width = parameters.width prompt[latentImageNodeId].inputs.height = parameters.height prompt[latentImageNodeId].inputs.batch_size = parameters.n_samples