Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Conversation

@virginiafdez
Copy link
Contributor

I fixed some typos in the Controlnet tutorial, and included new ControlNetDiffusionInferer functionality to make the code cleaner. The notebook's been ran again to account for modifications.
In response to: #443

virginiafdez added 2 commits December 13, 2023 16:23
…olNetDiffusionInferer to clean up the code.

Ran the notebook.
@virginiafdez virginiafdez linked an issue Dec 15, 2023 that may be closed by this pull request
Comment on lines +408 to +424
# Without using an inferer:
# progress_bar_sampling = tqdm(scheduler.timesteps, total=len(scheduler.timesteps), ncols=110)
# progress_bar_sampling.set_description("sampling...")
# sample = torch.randn((1, 1, 64, 64)).to(device)
# for t in progress_bar_sampling:
# with torch.no_grad():
# with autocast(enabled=True):
# down_block_res_samples, mid_block_res_sample = controlnet(
# x=sample, timesteps=torch.Tensor((t,)).to(device).long(), controlnet_cond=masks[0, None, ...]
# )
# noise_pred = model(
# sample,
# timesteps=torch.Tensor((t,)).to(device),
# down_block_additional_residuals=down_block_res_samples,
# mid_block_additional_residual=mid_block_res_sample,
# )
# sample, _ = scheduler.step(model_output=noise_pred, timestep=t, sample=sample)
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to leave this here or just point people to the definition of the inferer's sample method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just leaving them there in case a user did not want to use the inferer, as it was previously like that

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think its OK to leave it there, it might help users get a bit more insight into what the inferer is actually doing under the hood

Copy link
Member

@ericspod ericspod left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@marksgraham marksgraham merged commit 5743fa2 into main Dec 15, 2023
@marksgraham marksgraham deleted the 445-fix-controlnet-tutorial branch December 15, 2023 16:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix ControlNet tutorial

4 participants