Fix for RuntimeError: Expected a single top-level function#112
Open
rossdonald wants to merge 1 commit intolshqqytiger:mainfrom
Open
Fix for RuntimeError: Expected a single top-level function#112rossdonald wants to merge 1 commit intolshqqytiger:mainfrom
rossdonald wants to merge 1 commit intolshqqytiger:mainfrom
Conversation
…ode.py Replace lambda function with a dedicated wrapper class that provides a stable, inspectable object that the PyTorch JIT compiler can correctly handle.
|
Does it actually changes anything ? I had this error for a long time but i actually can use Stable Diffusion just fine with it. I had some issues earlier and i tought they are connected but everything got fixed. Maybe upscaling is still broken with it i haven't tested because i just Hires fix and it works. Edit: Anyway i will just swap the file and use it just in case |
Author
Well it fixes the error :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a RuntimeError that occurs during startup #13 #33
Expected a single top-level function: modules\dml\amp\autocast_mode.py
The JIT compiler cannot resolve the source code of these dynamically-generated, anonymous lambda functions, which is a requirement for its scripting process. When kornia attempts to script a function or class that uses one of these patched operations, the JIT compilation fails.
An instance of _AutocastForwarder is now used to patch each operation. This provides a stable, inspectable object that the PyTorch JIT compiler can correctly handle. functools.update_wrapper is also used to ensure the wrapper is transparent to introspection tools.