Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] fusion rewrite fails #99

Closed
soodoshll opened this issue Feb 13, 2023 · 1 comment · Fixed by #107
Closed

[Bug] fusion rewrite fails #99

soodoshll opened this issue Feb 13, 2023 · 1 comment · Fixed by #107

Comments

@soodoshll
Copy link
Collaborator

Running this snippet:

import torch
import hidet
import onnx

class Foo(torch.nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x, y):
        y = torch.min(y, dim=0)[0]
        z = x / y
        return z

device = 'cuda'

model = Foo()
model.to(device)

x = torch.rand([1, 1, 1, 1, 1], device=device)
y = torch.rand([2, 2], device=device)

z = model(x, y)
print(z.shape)

torch.onnx.export(model, (x, y), 'tmp.onnx', input_names = ['x', 'y'],
                  output_names = ['z'])
model = onnx.load('tmp.onnx')

hidet.torch.dynamo_config.search_space(1)

x = hidet.from_torch(x)
y = hidet.from_torch(y)
symbol_data = [hidet.symbol_like(x), hidet.symbol_like(y)]
hidet_onnx_module = hidet.graph.frontend.from_onnx(model)
symbol_output = hidet_onnx_module(*symbol_data)
graph: hidet.FlowGraph = hidet.trace_from(symbol_output, inputs=symbol_data)
with hidet.graph.PassContext() as ctx:
    graph_opt: hidet.FlowGraph = hidet.graph.optimize(graph)
cuda_graph = graph_opt.cuda_graph()
outputs = cuda_graph.run([x, y])

raises error message:

  File "/home/su/accdiff/thirdparty/hidet/python/hidet/transforms/tools/apply_prologue_epilogue.py", line 172, in visit_BufferStoreStmt
    remap: Dict[Var, Expr] = {a: b for a, b in strict_zip(tc.axes, out_indices)}
  File "/home/su/accdiff/thirdparty/hidet/python/hidet/utils/py.py", line 55, in strict_zip
    raise ValueError(
ValueError: Expect two sequence have the same length in zip, got length 5 and 1.
@yaoyaoding
Copy link
Member

Thanks @soodoshll, should be fixed in #107.

KTong821 added a commit to KTong821/hidet that referenced this issue Apr 24, 2024
Define complete UNet, with forward pass broken into down, mid, and up
sections. Useful diagrams
[here](http://jalammar.github.io/illustrated-stable-diffusion/)

Uses blocks defined in hidet-org#97. Heavily reduced version from diffusers
containing only necessary features for stable diffusion v2-1.

Towards hidet-org#57.

---------

Co-authored-by: vadiklyutiy <156319763+vadiklyutiy@users.noreply.github.com>
vadiklyutiy added a commit that referenced this issue Jul 22, 2024
Define complete UNet, with forward pass broken into down, mid, and up
sections. Useful diagrams
[here](http://jalammar.github.io/illustrated-stable-diffusion/)

Uses blocks defined in #97. Heavily reduced version from diffusers
containing only necessary features for stable diffusion v2-1.

Towards #57.

---------

Co-authored-by: vadiklyutiy <156319763+vadiklyutiy@users.noreply.github.com>
vadiklyutiy added a commit that referenced this issue Jul 23, 2024
Define complete UNet, with forward pass broken into down, mid, and up
sections. Useful diagrams
[here](http://jalammar.github.io/illustrated-stable-diffusion/)

Uses blocks defined in #97. Heavily reduced version from diffusers
containing only necessary features for stable diffusion v2-1.

Towards #57.

---------

Co-authored-by: vadiklyutiy <156319763+vadiklyutiy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants