Repository navigation
Conversation
|
/diffusers-bot pytest tests/models -k "cache" |
|
✅ |
|
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. |
|
/diffusers-bot pytest tests/models -k "cache" |
|
✅ |
| self.tensor_format = tensor_format | ||
| self.is_guidance_distilled = is_guidance_distilled | ||
|
|
||
| self.current_timestep_callback = current_timestep_callback |
There was a problem hiding this comment.
ohh I think since we are deprecate on 0.45.0, I think we need to make sure the current code (using callback etc) still works until then, no?
There was a problem hiding this comment.
Good point. Resolved for PAB, too. Added a simple test as well.
|
|
||
|
|
||
| @pytest.mark.parametrize("context_name", [None, "cond"]) | ||
| def test_timestep_is_required_without_callback(model, config_kwargs, inputs, context_name): |
There was a problem hiding this comment.
This is for the case when a pipeline doesn't implement the context and a user doesn't pass the callback either.
| callback = Mock(side_effect=AssertionError) | ||
| with pytest.warns(FutureWarning, match="current_timestep_callback"): | ||
| config = config_class(**kwargs, current_timestep_callback=callback) | ||
| model.enable_cache(config) |
There was a problem hiding this comment.
When a user configures a timestep callback in the cache config class, they will already get the deprecation notice. If the model has the cache context configured with timestep, then we fall back to it.
Otherwise, we use the deprecated behaviour. If neither of them is configured, we raise (tested in test_timestep_is_required_without_callback).
Should we also log a warning when both are configured (the callback and the caching context with timestep)? I don't think it's necessary.
In #14663, we decided to move away from using pipeline states in caching (through callbacks). This PR propagates the same for PAB and FasterCache.
As a result of the changes, the changeset looks bigger. But the core changes are in:
src/diffusers/hooks/faster_cache.pysrc/diffusers/hooks/pyramid_attention_broadcast.pytests/models/testing_utils/cache.pytests/pipelines/testing_utils/cache.pyWe also deprecate
current_timestep_callbackargument on both FasterCache and PAB.