Open clackhan opened 2 weeks ago
The changes introduce a detailed README file for the Flux example in the OneDiff Diffusers Extensions, covering environment setup, execution instructions, performance comparisons, dynamic shape handling, and quality assurance for image generation with the NexFort backend. Additionally, a new Python script (text_to_image_flux.py
) is added to facilitate image generation using command-line inputs, incorporating optimizations and a structured approach for users to specify parameters and manage the image generation process.
File Path | Change Summary |
---|---|
onediff_diffusers_extensions/examples/flux/README.md |
Added comprehensive sections for environment setup, execution instructions, performance comparison, dynamic shape, and quality. |
onediff_diffusers_extensions/examples/flux/text_to_image_flux.py |
Introduced a command-line interface for image generation using the Flux model, including argument parsing and performance optimizations. |
π° In the meadow where ideas bloom,
A README now clears the room.
With commands and setups laid out,
Image generation, thereβs no doubt!
Flux and NexFort, side by side,
Hop along, let creativity glide! πΌβ¨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
from nexfort.compilers import transform 0|comfy-0 | ImportError: cannot import name 'transform' from 'nexfort.compilers' (/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/nexfort/compilers/init.cpython-310-x86_64-linux-gnu.so)
Name: nexfort Version: 0.1.dev291 Summary: Next Generation Extension for PyTorch
@strint @clackhan
and can we have comfyui example as well?
from nexfort.compilers import transform 0|comfy-0 | ImportError: cannot import name 'transform' from 'nexfort.compilers' (/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/nexfort/compilers/init.cpython-310-x86_64-linux-gnu.so)
Name: nexfort Version: 0.1.dev291 Summary: Next Generation Extension for PyTorch
@strint @clackhan
@liho00 Please update nexfort https://pypi.org/project/nexfort/#history
from nexfort.compilers import transform 0|comfy-0 | ImportError: cannot import name 'transform' from 'nexfort.compilers' (/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/nexfort/compilers/init.cpython-310-x86_64-linux-gnu.so) Name: nexfort Version: 0.1.dev291 Summary: Next Generation Extension for PyTorch @strint @clackhan
@liho00 Please update nexfort https://pypi.org/project/nexfort/#history
@strint @clackhan got new error
Name: torch Version: 2.4.1
Name: nexfort Version: 0.1.dev293
NEXFORT_ENABLE_FP8_QUANTIZE_ATTENTION=0 python3 onediff_diffusers_extensions/examples/flux/text_to_image_flux.py --transform --saved-image flux_compile.png
/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/onnxscript/converter.py:820: FutureWarning: 'onnxscript.values.Op.param_schemas' is deprecated in version 0.1 and will be removed in the future. Please use '.op_signature' instead.
param_schemas = callee.param_schemas()
/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/onnxscript/converter.py:820: FutureWarning: 'onnxscript.values.OnnxFunction.param_schemas' is deprecated in version 0.1 and will be removed in the future. Please use '.op_signature' instead.
param_schemas = callee.param_schemas()
Loading checkpoint shards: 100%|βββββββββββββββββββββββββββββββββββββββββββββββ| 2/2 [00:00<00:00, 14.00it/s]
Loading pipeline components...: 43%|ββββββββββββββββββ | 3/7 [00:00<00:00, 14.61it/s]You set `add_prefix_space`. The tokenizer needs to be converted from the slow tokenizers
Loading pipeline components...: 100%|ββββββββββββββββββββββββββββββββββββββββββ| 7/7 [00:00<00:00, 8.65it/s]
compile...
Traceback (most recent call last):
File "/home/shadeform/onediff/onediff_diffusers_extensions/examples/flux/text_to_image_flux.py", line 231, in <module>
main()
File "/home/shadeform/onediff/onediff_diffusers_extensions/examples/flux/text_to_image_flux.py", line 186, in main
flux = FluxGenerator(args.model, args.quantize, args.transform, args.speedup_t5)
File "/home/shadeform/onediff/onediff_diffusers_extensions/examples/flux/text_to_image_flux.py", line 153, in __init__
self.pipe.transformer = transform(self.pipe.transformer)
File "src/nexfort/compilers/transform_model.py", line 42, in nexfort.compilers.transform_model.transform_model
File "src/nexfort/compilers/register_diffusers.py", line 15, in init nexfort.compilers.register_diffusers
File "src/nexfort/nn/modules.py", line 14, in init nexfort.nn.modules
File "src/nexfort/kernels/activations.py", line 43, in init nexfort.kernels.activations
File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/triton/runtime/jit.py", line 882, in jit
return decorator(fn)
File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/triton/runtime/jit.py", line 871, in decorator
return JITFunction(
File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/triton/runtime/jit.py", line 704, in __init__
self.starting_line_number = inspect.getsourcelines(fn)[1]
File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 1121, in getsourcelines
lines, lnum = findsource(object)
File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 940, in findsource
file = getsourcefile(object)
File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 817, in getsourcefile
filename = getfile(object)
File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/torch/package/package_importer.py", line 712, in _patched_getfile
return _orig_getfile(object)
File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 797, in getfile
raise TypeError('module, class, method, function, traceback, frame, or '
TypeError: module, class, method, function, traceback, frame, or code object was expected, got cython_function_or_method
from nexfort.compilers import transform 0|comfy-0 | ImportError: cannot import name 'transform' from 'nexfort.compilers' (/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/nexfort/compilers/init.cpython-310-x86_64-linux-gnu.so) Name: nexfort Version: 0.1.dev291 Summary: Next Generation Extension for PyTorch @strint @clackhan
@liho00 Please update nexfort https://pypi.org/project/nexfort/#history
@strint @clackhan got new error
Name: torch Version: 2.4.1
Name: nexfort Version: 0.1.dev293
NEXFORT_ENABLE_FP8_QUANTIZE_ATTENTION=0 python3 onediff_diffusers_extensions/examples/flux/text_to_image_flux.py --transform --saved-image flux_compile.png /home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/onnxscript/converter.py:820: FutureWarning: 'onnxscript.values.Op.param_schemas' is deprecated in version 0.1 and will be removed in the future. Please use '.op_signature' instead. param_schemas = callee.param_schemas() /home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/onnxscript/converter.py:820: FutureWarning: 'onnxscript.values.OnnxFunction.param_schemas' is deprecated in version 0.1 and will be removed in the future. Please use '.op_signature' instead. param_schemas = callee.param_schemas() Loading checkpoint shards: 100%|βββββββββββββββββββββββββββββββββββββββββββββββ| 2/2 [00:00<00:00, 14.00it/s] Loading pipeline components...: 43%|ββββββββββββββββββ | 3/7 [00:00<00:00, 14.61it/s]You set `add_prefix_space`. The tokenizer needs to be converted from the slow tokenizers Loading pipeline components...: 100%|ββββββββββββββββββββββββββββββββββββββββββ| 7/7 [00:00<00:00, 8.65it/s] compile... Traceback (most recent call last): File "/home/shadeform/onediff/onediff_diffusers_extensions/examples/flux/text_to_image_flux.py", line 231, in <module> main() File "/home/shadeform/onediff/onediff_diffusers_extensions/examples/flux/text_to_image_flux.py", line 186, in main flux = FluxGenerator(args.model, args.quantize, args.transform, args.speedup_t5) File "/home/shadeform/onediff/onediff_diffusers_extensions/examples/flux/text_to_image_flux.py", line 153, in __init__ self.pipe.transformer = transform(self.pipe.transformer) File "src/nexfort/compilers/transform_model.py", line 42, in nexfort.compilers.transform_model.transform_model File "src/nexfort/compilers/register_diffusers.py", line 15, in init nexfort.compilers.register_diffusers File "src/nexfort/nn/modules.py", line 14, in init nexfort.nn.modules File "src/nexfort/kernels/activations.py", line 43, in init nexfort.kernels.activations File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/triton/runtime/jit.py", line 882, in jit return decorator(fn) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/triton/runtime/jit.py", line 871, in decorator return JITFunction( File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/triton/runtime/jit.py", line 704, in __init__ self.starting_line_number = inspect.getsourcelines(fn)[1] File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 1121, in getsourcelines lines, lnum = findsource(object) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 940, in findsource file = getsourcefile(object) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 817, in getsourcefile filename = getfile(object) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/torch/package/package_importer.py", line 712, in _patched_getfile return _orig_getfile(object) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 797, in getfile raise TypeError('module, class, method, function, traceback, frame, or ' TypeError: module, class, method, function, traceback, frame, or code object was expected, got cython_function_or_method
please install torch==2.4.0 and try Again
from nexfort.compilers import transform 0|comfy-0 | ImportError: cannot import name 'transform' from 'nexfort.compilers' (/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/nexfort/compilers/init.cpython-310-x86_64-linux-gnu.so) Name: nexfort Version: 0.1.dev291 Summary: Next Generation Extension for PyTorch @strint @clackhan
@liho00 Please update nexfort https://pypi.org/project/nexfort/#history
@strint @clackhan got new error Name: torch Version: 2.4.1 Name: nexfort Version: 0.1.dev293
NEXFORT_ENABLE_FP8_QUANTIZE_ATTENTION=0 python3 onediff_diffusers_extensions/examples/flux/text_to_image_flux.py --transform --saved-image flux_compile.png /home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/onnxscript/converter.py:820: FutureWarning: 'onnxscript.values.Op.param_schemas' is deprecated in version 0.1 and will be removed in the future. Please use '.op_signature' instead. param_schemas = callee.param_schemas() /home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/onnxscript/converter.py:820: FutureWarning: 'onnxscript.values.OnnxFunction.param_schemas' is deprecated in version 0.1 and will be removed in the future. Please use '.op_signature' instead. param_schemas = callee.param_schemas() Loading checkpoint shards: 100%|βββββββββββββββββββββββββββββββββββββββββββββββ| 2/2 [00:00<00:00, 14.00it/s] Loading pipeline components...: 43%|ββββββββββββββββββ | 3/7 [00:00<00:00, 14.61it/s]You set `add_prefix_space`. The tokenizer needs to be converted from the slow tokenizers Loading pipeline components...: 100%|ββββββββββββββββββββββββββββββββββββββββββ| 7/7 [00:00<00:00, 8.65it/s] compile... Traceback (most recent call last): File "/home/shadeform/onediff/onediff_diffusers_extensions/examples/flux/text_to_image_flux.py", line 231, in <module> main() File "/home/shadeform/onediff/onediff_diffusers_extensions/examples/flux/text_to_image_flux.py", line 186, in main flux = FluxGenerator(args.model, args.quantize, args.transform, args.speedup_t5) File "/home/shadeform/onediff/onediff_diffusers_extensions/examples/flux/text_to_image_flux.py", line 153, in __init__ self.pipe.transformer = transform(self.pipe.transformer) File "src/nexfort/compilers/transform_model.py", line 42, in nexfort.compilers.transform_model.transform_model File "src/nexfort/compilers/register_diffusers.py", line 15, in init nexfort.compilers.register_diffusers File "src/nexfort/nn/modules.py", line 14, in init nexfort.nn.modules File "src/nexfort/kernels/activations.py", line 43, in init nexfort.kernels.activations File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/triton/runtime/jit.py", line 882, in jit return decorator(fn) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/triton/runtime/jit.py", line 871, in decorator return JITFunction( File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/triton/runtime/jit.py", line 704, in __init__ self.starting_line_number = inspect.getsourcelines(fn)[1] File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 1121, in getsourcelines lines, lnum = findsource(object) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 940, in findsource file = getsourcefile(object) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 817, in getsourcefile filename = getfile(object) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/site-packages/torch/package/package_importer.py", line 712, in _patched_getfile return _orig_getfile(object) File "/home/shadeform/miniconda3/envs/image/lib/python3.10/inspect.py", line 797, in getfile raise TypeError('module, class, method, function, traceback, frame, or ' TypeError: module, class, method, function, traceback, frame, or code object was expected, got cython_function_or_method
please install torch==2.4.0 and try Again
@strint @clackhan
Name: torch Version: 2.4.0
same issue happend tho, could you share us your environment list in correct requirements.txt?
Summary by CodeRabbit
New Features
Documentation