ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Using math without importing math

Open nanshenjiang opened this issue 1 year ago • 3 comments

https://github.com/comfyanonymous/ComfyUI/blob/66d35c07ce44b07011314ad7a28b2bdbcbb4e4cc/comfy/ldm/models/autoencoder.py#L184

nanshenjiang avatar Jul 30 '24 12:07 nanshenjiang

Are you sure it's not getting referenced in one of the imports or anything the imports import? Are you seeing any errors in the output log when using it(like if the max batch size isn't equal to None, to run the Else code that contains the math.ceil)? Does anything even use that AutoencodingEngineLegacy class?

RandomGitUser321 avatar Jul 31 '24 11:07 RandomGitUser321

Are you sure it's not getting referenced in one of the imports or anything the imports import? Are you seeing any errors in the output log when using it(like if the max batch size isn't equal to None, to run the Else code that contains the math.ceil)? Does anything even use that AutoencodingEngineLegacy class?

First, the IDE is unable to identify indirect imports. Regardless of whether it's an indirect import or not, I think it's desirable to use direct imports to prevent potential errors.

ltdrdata avatar Jul 31 '24 22:07 ltdrdata

Well I searched for "import math" and saw that pretty much anything that use or interact with the class, seems to import math already. For instance, it's in nodes.py, which I'm pretty sure will ALWAYS be used.

But yeah, it probably should just be included in that specific file.

RandomGitUser321 avatar Aug 01 '24 01:08 RandomGitUser321