Skip to content

Conversation

@changjonathanc
Copy link

What does this PR do?

  • add nonblocking and avoids creating tensor on cpu then immediately move to device
  • use cpu indexing in scheduler to avoid cuda sync/graph break

Who can review?

@a-r-r-o-w

Tests

main branch: there are 2 visible cuda sync

image

this branch: fixing both causes results in a nice profile view

image

profile is done by running the following code in a loop

def bench_fn():
    image = pipe(prompt, num_inference_steps=4, width=1024, height=1024, output_type="pt")
    image = image.cpu()

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@a-r-r-o-w a-r-r-o-w requested a review from yiyixuxu October 5, 2024 05:24
@yiyixuxu
Copy link
Collaborator

yiyixuxu commented Oct 9, 2024

are you testing with flux pipeline? you can just add a set_begin_index from the pipeline to avoid that search step

if hasattr(self.scheduler, "set_begin_index"):

@changjonathanc
Copy link
Author

changjonathanc commented Oct 28, 2024

Thanks for the pointer @yiyixuxu ! I updated the PR to use set_begin_index

@github-actions
Copy link
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.

@github-actions github-actions bot added the stale Issues that haven't received updates label Nov 21, 2024
@a-r-r-o-w a-r-r-o-w removed the stale Issues that haven't received updates label Nov 21, 2024
@a-r-r-o-w
Copy link
Contributor

a-r-r-o-w commented Nov 21, 2024

Hi, I apologize for the delay here. I have been profiling our pipelines and finding places for improvements continuosly to make Diffusers more production ready out-of-the-box. I will eventually club all PRs similar to this in the future and make sure that we don't have any synchronizations from start to end of pipeline execution

@github-actions
Copy link
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.

@github-actions github-actions bot added the stale Issues that haven't received updates label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Issues that haven't received updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants