Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 7.2k
Improve memory text to video#3930
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
8de409967fad272f3a9a63916c4df418e062184b53File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -634,6 +634,9 @@ def __call__( | ||
| # 6. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline | ||
| extra_step_kwargs = self.prepare_extra_step_kwargs(generator, eta) | ||
| # 6.1 Chunk feed-forward computation to save memory | ||
| self.unet.enable_forward_chunking(chunk_size=1, dim=1) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these reasonable defaults or should we also the users to specify these too? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reasonable defaults, here this means that we run one forward pass per frame | ||
| # 7. Denoising loop | ||
| num_warmup_steps = len(timesteps) - num_inference_steps * self.scheduler.order | ||
| with self.progress_bar(total=num_inference_steps) as progress_bar: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -399,5 +399,23 @@ def test_lora_xformers_on_off(self): | ||
| assert (sample - on_sample).abs().max() < 1e-4 | ||
| assert (sample - off_sample).abs().max() < 1e-4 | ||
| def test_feed_forward_chunking(self): | ||
| init_dict, inputs_dict = self.prepare_init_args_and_inputs_for_common() | ||
| init_dict["norm_num_groups"] = 32 | ||
| model = self.model_class(**init_dict) | ||
| model.to(torch_device) | ||
| model.eval() | ||
| with torch.no_grad(): | ||
| output = model(**inputs_dict)[0] | ||
| model.enable_forward_chunking() | ||
| with torch.no_grad(): | ||
| output_2 = model(**inputs_dict)[0] | ||
Comment on lines
+413
to
+416
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add another test for Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would also maybe test for another compatible chunk size to ensure feature robustness. | ||
| self.assertEqual(output.shape, output_2.shape, "Shape doesn't match") | ||
| assert np.abs(output.cpu() - output_2.cpu()).max() < 1e-2 | ||
| # (todo: sayakpaul) implement SLOW tests. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use
chunk_diminstead ofdim?