Skip to content

Adds Negative Prompts #61

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

Merged
merged 2 commits into from
Dec 21, 2022
Merged

Adds Negative Prompts #61

merged 2 commits into from
Dec 21, 2022

Conversation

JustinMeans
Copy link
Contributor

Adds a negativePrompt parameter to generateImages and produces a prompt embedding by concatenating the negative and positive prompt encodings.

let hiddenStates = toHiddenStates(concatEmbedding)

/// Setup schedulers
let scheduler = (0..<imageCount).map { _ in DPMSolverMultistepScheduler(stepCount: stepCount) }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there actually a Swift implementation of DPMSolverMultistepScheduler? Unfortunately I couldn't get this to compile. 😕

Copy link
Contributor Author

@JustinMeans JustinMeans Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, good catch. I was using a PR #59 for the DPMSolverMultistepScheduler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with b6787e1

@mfellner
Copy link

@JustinMeans I've taken the liberty of fixing the conflicts and also added a CLI option for the negative prompt here: mfellner#2 Feel free to pull the changes into this PR.

@atiorh
Copy link
Contributor

atiorh commented Dec 20, 2022

Hello @JustinMeans, thank you for your interest in contributing to Core ML Stable Diffusion! Please review CONTRIBUTING.md. If you would like to proceed with this pull request, please indicate your agreement to the terms outlined in CONTRIBUTING.md by checking the box below.

We appreciate your interest in the project!

  • I agree to the terms outlined in CONTRIBUTING.md

@atiorh
Copy link
Contributor

atiorh commented Dec 20, 2022

Please note that a later PR (#76) implements the same feature in fewer line changes but we wanted to see if you would want to revise your PR to minimize the line changes as you submitted earlier (FIFO). I will be on standby for 48 hours to hear from you and then merge #76 instead if I don't hear back. Thank you again!

@JustinMeans JustinMeans reopened this Dec 21, 2022
@JustinMeans
Copy link
Contributor Author

  • I agree to the terms outlined in CONTRIBUTING.md

@JustinMeans
Copy link
Contributor Author

Hi @atiorh, thanks for the note. I've gone ahead and re-synced this PR and re-implemented to minimize line changes.

Copy link
Contributor Author

@JustinMeans JustinMeans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ready to go. Thanks @mfellner for the help.

@atiorh
Copy link
Contributor

atiorh commented Dec 21, 2022

Cool, this is very similar to #76 now so I will manually add @Wanaldino as a co-author in the merge commit. Thanks for the contribution both!

@atiorh atiorh merged commit c90b705 into apple:main Dec 21, 2022
@atiorh atiorh mentioned this pull request Dec 21, 2022
1 task
takeyat pushed a commit to takeyat/ml-stable-diffusion that referenced this pull request Dec 25, 2022
* commit 'e07c4d00c387840f70fa3701fb3a51c2a32f37b8':
  Move guidanceScale as generation parameter (apple#46)
  Add brief instructions to download weights from the Hub (apple#10)
  Adds Negative Prompts (apple#61)
  Changed seed type into UInt32 (apple#47)
  fixes apple#77
  Update README.md (apple#66)
  Add Filename Character Limit (apple#19)
  Implement DPM-Solver++ scheduler (apple#59)
  Fix typos: Successfully facilitate getting pipeline overridden (apple#30)
  Undefined name: from typing import List (apple#31)
  Add Availability Annotations (apple#18)
  README improvements and reduceMemory option in Swift
@pd95 pd95 mentioned this pull request Dec 28, 2022
1 task
@mozzipa
Copy link

mozzipa commented Feb 24, 2023

When I use --negative-prompt option for several cases, only one word were able. is there way to use various word for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants