Updated to script generation to use torch inference_mode and reverted back to using VAEDecode instead of VAEDecodeTiled
This commit is contained in:
@@ -197,10 +197,6 @@ def get_class_info(class_type: str) -> (str, str, str):
|
||||
import_statement (str): Import statement string
|
||||
class_code (str): Class initialization code
|
||||
"""
|
||||
# If the class is 'VAEDecode', adjust the class name
|
||||
if class_type == 'VAEDecode':
|
||||
class_type = 'VAEDecodeTiled'
|
||||
|
||||
import_statement = class_type
|
||||
class_code = f'{class_type.lower()} = {class_type}()'
|
||||
|
||||
@@ -221,7 +217,7 @@ def assemble_python_code(import_statements: set, loader_code: List[str], code: L
|
||||
"""
|
||||
static_imports = ['import random']
|
||||
imports_code = [f"from nodes import {', '.join([class_name for class_name in import_statements])}" ]
|
||||
main_function_code = f"def main():\n\t" + '\n\t'.join(loader_code) + f'\n\n\tfor q in range({queue_size}):\n\t' + '\n\t'.join(code)
|
||||
main_function_code = f"def main():\n\t" + 'with torch.inference_mode():\n\t' + '\n\t'.join(loader_code) + f'\n\n\tfor q in range({queue_size}):\n\t' + '\n\t'.join(code)
|
||||
final_code = '\n'.join(static_imports + ['import sys\nsys.path.append("../")'] + imports_code + ['', main_function_code, '', 'if __name__ == "__main__":', '\tmain()'])
|
||||
final_code = black.format_str(final_code, mode=black.Mode())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user