Skip to content

The first image generated with LMSScheduler is completely green #454

Closed

Description

@allo-

Describe the bug

The first image generated with LMSScheduler is just a green image.

Reproduction

Run with:

lms = LMSDiscreteScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear"
pipe = StableDiffusionPipeline.from_pretrained(..., scheduler=lms)

instead of using the default scheduler. Then the first image is completely green. The workaround I am using is to run one step before the actual diffuse function:

if isinstance(pipe.scheduler, LMSDiscreteScheduler):
    # Prevent an empty first frame
    with autocast("cuda"):
        image = diffuse(pipe, text_embeddings, init1, 1, settings["guidance_scale"], eta)

Afterward I compute images similarly, but using e.g. 50 steps instead of one and everything is fine. The default scheduler also seems to work. I did not test other schedulers yet.

System Info

Diffusers from git, python 3.10.6, CUDA with a RTX 3060 card

Activity

  1. added
    bugSomething isn't working
    on Sep 9, 2022
  2. changed the title [-]The first image generated with LMSScheduler is green[/-] [+]The first image generated with LMSScheduler is completely green[/+] on Sep 9, 2022
  3. patrickvonplaten commented on Sep 13, 2022

    @patrickvonplaten
    Contributor
  4. patrickvonplaten commented on Sep 13, 2022

    @patrickvonplaten
    Contributor

    Probably related to: #336

  5. github-actions commented on Oct 10, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

    Please note that issues that do not follow the contributing guidelines are likely to be ignored.

  6. added
    staleIssues that haven't received updates
    and removed
    bugSomething isn't working
    on Oct 10, 2022
  7. patrickvonplaten commented on Oct 11, 2022

    @patrickvonplaten
    Contributor

    @allo- is this issue still relevant?

  8. allo- commented on Oct 11, 2022

    @allo-
    ContributorAuthor

    I removed the workaround and cannot reproduce the issue. I guess I close here for now and if my scripts without the workarounds get the problem again I reopen or make a new issue.

  9. anton-l commented on Oct 12, 2022

    @anton-l
    Member

    Yes, the issue was caused by improper LMS timesteps initialization and should be fixed now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssues that haven't received updates

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions