Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ControlNet tile model handling to img2img and inpaint modes #65

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added support for ControlNet lineart, scribble, and openpose (face on…
…ly or full)
  • Loading branch information
Danamir committed May 18, 2023
commit b20fa5574a058f03b9f9c0e452e4c3624dbcdab7
25 changes: 20 additions & 5 deletions src/GenerateTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,27 @@ export default {
imagesNumber: 4,
styles: [],

cnModes: ['disabled', 'tile'],
cnModes: ['disabled', 'tile', 'openface', 'openpose', 'lineart', 'scribble'],
cnMode: 'disabled',
cnWeight: 100,
cnGuidanceStart: 0,
cnGuidanceEnd: 100,
cnModel: 'control_v11f1e_sd15_tile_fp16',
cnModules: {
disabled: undefined,
tile: undefined,
lineart: 'lineart_coarse',
openpose: 'openpose_full',
openface: 'openpose_faceonly',
scribble: 'pidinet_sketch',
},
cnModels: {
disabled: undefined,
tile: 'control_v11f1e_sd15_tile_fp16',
lineart: 'control_v11p_sd15_lineart_fp16',
openpose: 'control_v11p_sd15_openpose_fp16',
openface: 'control_v11p_sd15_openpose_fp16',
scribble: 'control_v11p_sd15_scribble_fp16',
},

generatedImages: [],
currentGeneratedImageIndex: 0,
Expand Down Expand Up @@ -653,9 +668,9 @@ export default {

let resDataImages = res.data.images;

if (this.cnMode !== 'disabled') {
resDataImages.pop(); // last image is controlNet input image
}
// if (this.cnMode !== 'disabled') {
// resDataImages.pop(); // last image is controlNet input image
// }

if (this.isSaveImagesLocally) {
await this.saveGeneratedImagesLocally(resDataImages, JSON.parse(res.data.info).all_seeds);
Expand Down
8 changes: 4 additions & 4 deletions src/maskGeneratorMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,16 @@ export default {
img2imgData.prompt = 'prompt'; // fake prompt to avoid batch crash
}

if (this.cnMode === 'tile') {
if (this.cnMode !== 'disabled') {
img2imgData.alwayson_scripts.controlnet = {
args: [
{
weight: this.cnWeight / 100,
guidance_start: this.cnGuidanceStart / 100,
guidance_end: this.cnGuidanceEnd / 100,
module: undefined,
pixel_perfect: false,
model: this.cnModel,
module: this.cnModules[this.cnMode],
pixel_perfect: true,
model: this.cnModels[this.cnMode],
},
],
};
Expand Down