Skip to content
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

[issue] Compatibility with torch.compile() if torch >= 2.0 #26

Open
jyoung105 opened this issue Feb 28, 2024 · 4 comments
Open

[issue] Compatibility with torch.compile() if torch >= 2.0 #26

jyoung105 opened this issue Feb 28, 2024 · 4 comments

Comments

@jyoung105
Copy link

Thanks for great work once again.

I would like to ask you,
whether it can work with torch.compile().

If it is, maybe it can work so faster.
I got an error below when I combine with together.

Unsupported: class property UNet2DConditionModel getset_descriptor

from user code:
   File "/usr/local/lib/python3.10/dist-packages/diffusers/models/modeling_utils.py", line 211, in __getattr__
    is_in_config = "_internal_dict" in self.__dict__ and hasattr(self.__dict__["_internal_dict"], name)

Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information
@horseee
Copy link
Owner

horseee commented Mar 4, 2024

Hi @jyoung105,

DeepCache is a dynamic model inference algorithm, which makes it incompatible with torch.compile(). One possible solution (though I'm not certain) is to split the entire pipeline into two models: one for the whole network inference and the other for partial network inference (the shallow on). This way, both of these models can be converted into static models, thus supporting torch.compile().

@jyoung105
Copy link
Author

I think the one you say is on the project 'onediff'.
They enable both torch.compile() and your awesome project. And they ask you to set their way to deal with memory named oneflow, too. Thanks for your kindness!

@HuiZhang0812
Copy link

Hello, do you have any solution now?

@jyoung105
Copy link
Author

Hi, I think you should check it on onediff. (https://github.com/siliconflow/onediff[https://github.com/siliconflow/onediff])
They split the code for compiler and deepcache and make them compatible with each other.
I didn't read the code in detail due to busy works in recentrly, but if you need, I will check it and share how codes are working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants