siliconflow / onediff

OneDiff: An out-of-the-box acceleration library for diffusion models.
https://github.com/siliconflow/onediff/wiki
Apache License 2.0
1.7k stars 104 forks source link

AttributeError: 'OneflowGraph' object has no attribute '_input_op_names' #886

Closed awzhgw closed 4 months ago

awzhgw commented 6 months ago

how to fix this error ?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/gradio/queueing.py", line 528, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py", line 270, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1908, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1485, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/dist-packages/gradio/utils.py", line 808, in wrapper
    response = f(*args, **kwargs)
  File "/export/App/training_platform/PinoModel/yisol/idm-server/app.py", line 233, in start_tryon
    images = pipe(
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/export/App/training_platform/PinoModel/yisol/idm-server/src/tryon_pipeline.py", line 1796, in __call__
    noise_pred = self.unet(
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1582, in _call_impl
    result = forward_call(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onediff/infer_compiler/utils/online_quantization_utils.py", line 51, in wrapper
    output = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onediff/infer_compiler/utils/args_tree_util.py", line 50, in wrapper
    output = func(self, *mapped_args, **mapped_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onediff/infer_compiler/oneflow/utils.py", line 27, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onediff/infer_compiler/utils/graph_management_utils.py", line 121, in wrapper
    ret = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onediff/infer_compiler/oneflow/deployable_module.py", line 99, in forward
    output = dpl_graph(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/graph.py", line 295, in __call__
    self._compile(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/graph.py", line 861, in _compile
    return self._dynamic_input_graph_cache._compile(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/cache.py", line 121, in _compile
    return graph._compile(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/graph.py", line 865, in _compile
    return self._compile_new(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/graph.py", line 884, in _compile_new
    _, eager_outputs = self.build_graph(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/graph.py", line 1429, in build_graph
    outputs = self.__build_graph(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/graph.py", line 1577, in __build_graph
    outputs = self.build(*lazy_args, **lazy_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onediff/infer_compiler/oneflow/graph.py", line 19, in build
    return self.model(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 188, in __call__
    result = self.__block_forward(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 238, in __block_forward
    result = unbound_forward_of_module_instance(self, *args, **kwargs)
  File "/export/App/training_platform/PinoModel/yisol/idm-server/src/unet_hacked_tryon.py", line 1289, in forward
    sample, res_samples,curr_garment_feat_idx = downsample_block(
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 188, in __call__
    result = self.__block_forward(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 238, in __block_forward
    result = unbound_forward_of_module_instance(self, *args, **kwargs)
  File "/export/App/training_platform/PinoModel/yisol/idm-server/src/unet_block_hacked_tryon.py", line 1176, in forward
    hidden_states,curr_garment_feat_idx = attn(
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 188, in __call__
    result = self.__block_forward(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 238, in __block_forward
    result = unbound_forward_of_module_instance(self, *args, **kwargs)
  File "/export/App/training_platform/PinoModel/yisol/idm-server/src/transformerhacked_tryon.py", line 397, in forward
    hidden_states,curr_garment_feat_idx = block(
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 188, in __call__
    result = self.__block_forward(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 238, in __block_forward
    result = unbound_forward_of_module_instance(self, *args, **kwargs)
  File "/export/App/training_platform/PinoModel/yisol/idm-server/src/attentionhacked_tryon.py", line 337, in forward
    attn_output = self.attn1(
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 188, in __call__
    result = self.__block_forward(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 238, in __block_forward
    result = unbound_forward_of_module_instance(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/infer_compiler_registry/register_diffusers/attention_processor_oflow.py", line 363, in forward
    return self.processor(
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 188, in __call__
    result = self.__block_forward(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 238, in __block_forward
    result = unbound_forward_of_module_instance(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/modules/module.py", line 200, in forward
    raise NotImplementedError()
NotImplementedError

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/gradio/queueing.py", line 528, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py", line 270, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1908, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1485, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/dist-packages/gradio/utils.py", line 808, in wrapper
    response = f(*args, **kwargs)
  File "/export/App/training_platform/PinoModel/yisol/idm-server/app.py", line 233, in start_tryon
    images = pipe(
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/export/App/training_platform/PinoModel/yisol/idm-server/src/tryon_pipeline.py", line 1796, in __call__
    noise_pred = self.unet(
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1582, in _call_impl
    result = forward_call(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onediff/infer_compiler/utils/online_quantization_utils.py", line 51, in wrapper
    output = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/onediff/infer_compiler/utils/args_tree_util.py", line 42, in wrapper
    count = len(self._deployable_module_dpl_graph._input_op_names)
  File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/graph.py", line 2152, in __getattr__
    raise AttributeError(
AttributeError: 'OneflowGraph' object has no attribute '_input_op_names'
lijunliangTG commented 5 months ago

Could you please tell me how I can reproduce this script? What are the versions of onediff and oneflow that you are using?

strint commented 4 months ago

File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/graph/proxy.py", line 238, in __block_forward result = unbound_forward_of_module_instance(self, *args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/oneflow/nn/modules/module.py", line 200, in forward raise NotImplementedError() NotImplementedError

You are running with a module that has no forward method implemented.

I guess it's a new model that we haven't run with.