diff --git a/onnxscript/rewriter/onnxruntime/transformers/__init__.py b/onnxscript/rewriter/onnxruntime/transformers/__init__.py index e8114ac9b..84c73d7b7 100644 --- a/onnxscript/rewriter/onnxruntime/transformers/__init__.py +++ b/onnxscript/rewriter/onnxruntime/transformers/__init__.py @@ -12,6 +12,7 @@ multihead_attention.GQALlama2RewriteRule, multihead_attention.GQALlamaSdpa2RewriteRule, multihead_attention.AttnPhi15RewriteRule, + multihead_attention.MHAStableDiffusionUnetRewriteRule, layernorm.LNRewriteRule, fastgelu.GeluRewriteRule, biassplitgelu.GegluRewriteRule, diff --git a/onnxscript/rewriter/onnxruntime/transformers/multihead_attention.py b/onnxscript/rewriter/onnxruntime/transformers/multihead_attention.py index c41626297..9c16ef975 100644 --- a/onnxscript/rewriter/onnxruntime/transformers/multihead_attention.py +++ b/onnxscript/rewriter/onnxruntime/transformers/multihead_attention.py @@ -55,7 +55,7 @@ import onnxscript from onnxscript import ir -from onnxscript.rewriter import function_rule +from onnxscript.rewriter import _ir_utils, function_rule logger = logging.getLogger(__name__) @@ -63,31 +63,69 @@ @dataclasses.dataclass class AttnSizeConfig: num_attention_heads: int - num_key_value_heads: int + num_key_value_heads: int | None head_size: int hidden_size: int class AttentionRewriteRule(function_rule.FunctionRewriteRule, abc.ABC): def infer_attn_size_config(self, function: ir.Function) -> AttnSizeConfig: - if len(function.outputs) != 3: + if len(function.outputs) == 3: + # Usually the Attention related modules have 3 outputs: + # present_value, present_key, attn_output + present_value, _, attn_output = function.outputs + if present_value.shape is None: + raise function_rule.FunctionRewriteError( + "Failed to find shape for present_value." + ) + if attn_output.shape is None: + raise function_rule.FunctionRewriteError( + "Failed to find shape for attn_output." + ) + head_size = present_value.shape[3] + num_key_value_heads = present_value.shape[1] + hidden_size = attn_output.shape[2] + num_attention_heads = hidden_size // head_size + return AttnSizeConfig( + num_attention_heads=num_attention_heads, + num_key_value_heads=num_key_value_heads, + head_size=head_size, + hidden_size=hidden_size, + ) + elif any("scaled_dot_product_attention" in node.op_type for node in function): + # If the Attention related modules use scaled_dot_product_attention, + # present_value and present_key are not present in the output. + hidden_size = function.outputs[0].shape[2] + # Get head size and number of heads from the Reshape node. + # Reference: + # https://github.com/huggingface/diffusers/blob/ae05050db9d37d5af48a6cd0d6510a5ffb1c1cd4/src/diffusers/models/attention_processor.py#L1269 + reshape_nodes = [node for node in function if node.op_type == "Reshape"] + assert ( + len(reshape_nodes) == 4 + ), "Expected 3 Reshape nodes for Q, K and V, and 1 reshape node for output of scaled_dot_product_attention." + for reshape_node in reshape_nodes: + constant_node = reshape_node.inputs[1].producer() + assert ( + constant_node.op_type == "Constant" + ), "Expected the second input to Reshape to be a Constant node." + value = _ir_utils.propagate_const_value(reshape_node.inputs[1]) + constant_numpy_value = _ir_utils.get_numpy_from_ir_value(value) + if constant_numpy_value.shape[0] == 4: + num_attention_heads = constant_numpy_value[2] + head_size = constant_numpy_value[3] + return AttnSizeConfig( + num_attention_heads=num_attention_heads, + num_key_value_heads=None, + head_size=head_size, + hidden_size=hidden_size, + ) raise function_rule.FunctionRewriteError( - f"Unexpected number of outputs. Expected 3, got {len(function.outputs)}." + "Failed to infer head size and number of heads from QKV Reshape nodes. \ + Expected 4D shape in the constant node (batch_size, seq_length, num_attention_heads, head_size)." ) - present_value, _, attn_output = function.outputs - if present_value.shape is None: - raise function_rule.FunctionRewriteError("Failed to find shape for present_value.") - if attn_output.shape is None: - raise function_rule.FunctionRewriteError("Failed to find shape for attn_output.") - head_size = present_value.shape[3] - num_key_value_heads = present_value.shape[1] - hidden_size = attn_output.shape[2] - num_attention_heads = hidden_size // head_size - return AttnSizeConfig( - num_attention_heads=num_attention_heads, - num_key_value_heads=num_key_value_heads, - head_size=head_size, - hidden_size=hidden_size, + raise function_rule.FunctionRewriteError( + f"Attenion modules should have 3 outputs or scaled_dot_product_attention node, " + f"got output: {len(function.outputs)} and no scaled_dot_product_attention." ) @@ -96,14 +134,11 @@ class MHALlama2RewriteRule(AttentionRewriteRule): PACKAGE_NAME = "transformers" _version_controller = function_rule.VersionController() - def __init__(self) -> None: - super().__init__() - @_version_controller.register_version(min_version="4.33", max_version="4.36") def _fusion_with_4d_cache(self, function: ir.Function) -> ir.Function: - if len(function.input) != 9: + if len(function.inputs) != 9: raise function_rule.FunctionRewriteError( - f"Unexpected number of inputs. Expected 9, got {len(function.input)}." + f"Unexpected number of inputs. Expected 9, got {len(function.inputs)}." ) # Infer size configurations from the function. @@ -172,9 +207,9 @@ def _fusion_with_2d_cache(self, function: ir.Function) -> ir.Function: # Infer size configurations from the function. attn_size_config = self.infer_attn_size_config(function) - if len(function.input) != 9: + if len(function.inputs) != 9: raise function_rule.FunctionRewriteError( - f"Unexpected number of inputs. Expected 9, got {len(function.input)}." + f"Unexpected number of inputs. Expected 9, got {len(function.inputs)}." ) # Code new pattern with onnxscript. @@ -234,9 +269,6 @@ class GQALlama2RewriteRule(AttentionRewriteRule): PACKAGE_NAME = "transformers" _version_controller = function_rule.VersionController() - def __init__(self) -> None: - super().__init__() - @_version_controller.register_version(min_version="4.33", max_version="4.36") def _fusion_with_4d_cache(self, function: ir.Function) -> ir.Function: if len(function.inputs) != 9: @@ -384,9 +416,6 @@ class GQALlamaSdpa2RewriteRule(AttentionRewriteRule): PACKAGE_NAME = "transformers" _version_controller = function_rule.VersionController() - def __init__(self) -> None: - super().__init__() - @_version_controller.register_version(min_version="4.36", max_version="4.38") def _fusion(self, function: ir.Function) -> ir.Function: # Infer size configurations from the function. @@ -451,7 +480,6 @@ def gqa( def _fusion_without_cos_sin_cache(self, function: ir.Function) -> ir.Function: # Infer size configurations from the function. attn_size_config = self.infer_attn_size_config(function) - # Code new pattern with onnxscript. op = onnxscript.opset18 msft_op = onnxscript.values.Opset("com.microsoft", 1) @@ -528,9 +556,6 @@ class AttnPhi15RewriteRule(AttentionRewriteRule): PACKAGE_NAME = "transformers_modules" _version_controller = function_rule.VersionController() - def __init__(self) -> None: - super().__init__() - @_version_controller.register_version() def _fusion(self, function: ir.Function) -> ir.Function: # Infer size configurations from the function. @@ -592,3 +617,90 @@ def phi_attention( phi_attention ).to_function_proto() return ir.serde.deserialize_function(function_proto) + + +class MHAStableDiffusionUnetRewriteRule(AttentionRewriteRule): + """Rewrite rule for Attention in diffusers.""" + + FUNCTION_KEYWORD = "Attention" + PACKAGE_NAME = "diffusers" + _version_controller = function_rule.VersionController() + + @_version_controller.register_version() + def _fusion(self, function: ir.Function) -> ir.Function: + # Attention inputs could be 6 or 7: + # hidden_states, encoder_hidden_states(optional), q_weight, k_weight, v_weight, o_weight, o_bias + if len(function.inputs) != 6 and len(function.inputs) != 7: + raise function_rule.FunctionRewriteError( + f"Unexpected number of inputs. Expected 6 or 7, got {len(function.inputs)}." + ) + + # Infer size configurations from the function. + attn_size_config = self.infer_attn_size_config(function) + + # Code new pattern with onnxscript. + op = onnxscript.opset18 + msft_op = onnxscript.values.Opset("com.microsoft", 1) + + def attention( + hidden_states, + q_weight, + k_weight, + v_weight, + o_weight, + o_bias, + ): + qkv_weight = op.Transpose( + op.Concat(q_weight, k_weight, v_weight, axis=0), + perm=[1, 0], + ) + + # NOTE: MHA does not work when Q, K, and V has the same root inputs. + attn_output, _ = msft_op.Attention( + hidden_states, + qkv_weight, + None, + None, + num_heads=attn_size_config.num_attention_heads, + ) + + # linear projection + output = op.Add(op.MatMul(attn_output, op.Transpose(o_weight, [1, 0])), o_bias) + return output + + def mha( + hidden_states, + encoder_hidden_states, + q_weight, + k_weight, + v_weight, + o_weight, + o_bias, + ): + q = op.MatMul(hidden_states, op.Transpose(q_weight, [1, 0])) + k = op.MatMul(encoder_hidden_states, op.Transpose(k_weight, [1, 0])) + v = op.MatMul(encoder_hidden_states, op.Transpose(v_weight, [1, 0])) + + # NOTE: Q and K needs to have the sequence length (dim 1) to use + # GQA. + mha_output, _, _ = msft_op.MultiHeadAttention( + q, + k, + v, + None, + None, + num_heads=attn_size_config.num_attention_heads, + ) + attn_output = op.Add(op.MatMul(mha_output, op.Transpose(o_weight, [1, 0])), o_bias) + return attn_output + + if len(function.inputs) == 6: + function_proto = onnxscript.script(default_opset=onnxscript.opset18)( + attention + ).to_function_proto() + return ir.serde.deserialize_function(function_proto) + + function_proto = onnxscript.script(default_opset=onnxscript.opset18)( + mha + ).to_function_proto() + return ir.serde.deserialize_function(function_proto) diff --git a/onnxscript/rewriter/onnxruntime/transformers/multihead_attention_test.py b/onnxscript/rewriter/onnxruntime/transformers/multihead_attention_test.py index 26c8c12f2..1e2f1d51c 100644 --- a/onnxscript/rewriter/onnxruntime/transformers/multihead_attention_test.py +++ b/onnxscript/rewriter/onnxruntime/transformers/multihead_attention_test.py @@ -55,6 +55,12 @@ def test_sdpa_yi_4_38(self): "sdpa_yi_4_38", 1, {("com.microsoft", "GroupQueryAttention", "")} ) + @testutils.skip_if_no_cuda("CPU has parity issue.") + def test_attn_stable_diffusion_unet(self): + testutils.test_onnxruntime_rewrite( + "attn_stable_diffusion_unet", 2, {("com.microsoft", "MultiHeadAttention", "")} + ) + class AttnParityTest(unittest.TestCase): def setUp(self): @@ -66,6 +72,14 @@ def test_attn_phi_1_5(self): "attn_phi_1_5", 4, {("com.microsoft", "Attention", "")} ) + @testutils.skip_if_no_cuda("CPU has parity issue.") + def test_attn_stable_diffusion_unet_without_encoder_hidden_states(self): + testutils.test_onnxruntime_rewrite( + "attn_stable_diffusion_unet_without_encoder_hidden_states", + 2, + {("com.microsoft", "Attention", "")}, + ) + if __name__ == "__main__": unittest.main() diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_0/attn_stable_diffusion_unet_0.onnx b/testdata/unittest_models/attn_stable_diffusion_unet_0/attn_stable_diffusion_unet_0.onnx new file mode 100644 index 000000000..156119af1 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_0/attn_stable_diffusion_unet_0.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29d233e3bd288d34719ded40b44ea4049858144a6563418caa74faa49a94aabe +size 1730321 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_0.pb b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_0.pb new file mode 100644 index 000000000..0a54201fd --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_0.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7cbd3a7ebe268f4c5133dd4260f7a584f928f4bc234b94acfaa28477aedf4e8c +size 10485776 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_1.pb b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_1.pb new file mode 100644 index 000000000..cd0b47c10 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_1.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9123c6554ff4d7314551d483f9094d87242a7f4c37244e749db9d4645e4b297 +size 2060 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_2.pb b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_2.pb new file mode 100644 index 000000000..66d6c25cf --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_2.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:253f5e6539e7f85ea8b3e62c253308f8309e836099d2bc80e4b349bba4198a71 +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_3.pb b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_3.pb new file mode 100644 index 000000000..4a8bf726b --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_3.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7b87c3af883c4914b77dac7f4eaa0d5c0537ca208e003ceaa8c8458a430b79e +size 655372 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_4.pb b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_4.pb new file mode 100644 index 000000000..eecc57336 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_4.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0a14710d96f88687271c91010609c9767741282c8736d410e65776f055d9022 +size 655372 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_5.pb b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_5.pb new file mode 100644 index 000000000..cd8138a4b --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_5.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ccce625f60f9b8a22752b14efc04ddfbb4b1b86d7cd158de8bb738ba592529d3 +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_6.pb b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_6.pb new file mode 100644 index 000000000..c2de649ee --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/input_6.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c987816fb124802ffcb8e454d1775760419c3a589f400963b34e638da4f03264 +size 648 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/output_0.pb b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/output_0.pb new file mode 100644 index 000000000..e74f70b00 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_0/test_data_set_0/output_0.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45b669a398c141036e6c3dac09740f875211d19a0e753bd11463db03914141bb +size 10485776 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_1/attn_stable_diffusion_unet_1.onnx b/testdata/unittest_models/attn_stable_diffusion_unet_1/attn_stable_diffusion_unet_1.onnx new file mode 100644 index 000000000..09414bdb6 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_1/attn_stable_diffusion_unet_1.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a87363b7b2c6dddbfd72adb5e22a165729b8756ff95e4d2f3c5abf01ad42ab91 +size 1730335 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_0.pb b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_0.pb new file mode 100644 index 000000000..e0e28bb6f --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_0.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:613695863f84e1ea2f7ed2c40b48f1cfc90aa019c7f5c9a13dc058a3350ba56a +size 10485776 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_1.pb b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_1.pb new file mode 100644 index 000000000..cd0b47c10 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_1.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9123c6554ff4d7314551d483f9094d87242a7f4c37244e749db9d4645e4b297 +size 2060 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_2.pb b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_2.pb new file mode 100644 index 000000000..0413700b6 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_2.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75b8a9ff46821223424751ea8623f28fa874a08078a20e824ac64cdbe4f4f080 +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_3.pb b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_3.pb new file mode 100644 index 000000000..c6dd5f592 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_3.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85c736a78bc193939361a1a5c70f15d485a5f3b195e392895476129c11268bec +size 655372 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_4.pb b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_4.pb new file mode 100644 index 000000000..7f742d668 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_4.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba47a7b359e8e83e0992c5379bd8aebed1829c5b9e076c1f83cfbfdf802ae4e4 +size 655372 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_5.pb b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_5.pb new file mode 100644 index 000000000..b3638b73f --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_5.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:179d9b92f75a1f49da5ab08d120a8e368b4b8328ae33cbb246a153ceac394d9e +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_6.pb b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_6.pb new file mode 100644 index 000000000..236b35dd5 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/input_6.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db4fe0a2c9df70cf78bb9c3ae5ba56ee5dc2bd97182035cf8281b4e6eb505c35 +size 648 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/output_0.pb b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/output_0.pb new file mode 100644 index 000000000..27029d314 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_1/test_data_set_0/output_0.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22fa6a580cb5b09c666822f0885bd74e9cf1a9ce20a32cc88b962c1bb8456bf6 +size 10485776 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/attn_stable_diffusion_unet_without_encoder_hidden_states_0.onnx b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/attn_stable_diffusion_unet_without_encoder_hidden_states_0.onnx new file mode 100644 index 000000000..cf6176d98 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/attn_stable_diffusion_unet_without_encoder_hidden_states_0.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26b1befffc3399801cb147081ed137182bc0b5f08c1a3c4d2a8b5d9685e53e91 +size 828870 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_0.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_0.pb new file mode 100644 index 000000000..e84fc81a0 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_0.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a155c68af7b5f774e8cd35367f8a64b3d2e710b2fb855654eea3b1f295eea88f +size 10485776 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_1.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_1.pb new file mode 100644 index 000000000..7b6f4cc2b --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_1.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6f6ee7a66f70abbb4eeb09dcaefcee989107e75e75fd10ee88047a335ef2f99 +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_2.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_2.pb new file mode 100644 index 000000000..e6e368680 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_2.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:774e3826110d1042bbdabc63bef06bf34ba4835dd53592cf48fdad8c0500cacf +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_3.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_3.pb new file mode 100644 index 000000000..7049322c8 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_3.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed4b34f65ae24ee2513c6aeacac76b6ae1da36e273949ddb89abf1aaf3ddbf27 +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_4.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_4.pb new file mode 100644 index 000000000..371356ae3 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_4.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd578ddf3c26faee41e5e3f63039b6c133d9a7561c75ecd39c8f0ade1ebee5ac +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_5.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_5.pb new file mode 100644 index 000000000..de88d9814 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/input_5.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80b564d4c454130e226d9e6eb736fd6daf1d7dfb59a98ecc0231b4475faa867d +size 648 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/output_0.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/output_0.pb new file mode 100644 index 000000000..47c4919e6 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_0/test_data_set_0/output_0.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87ebf96028626265bb70249cb7b962d769530daeef8248f38fc26368584f0ca3 +size 10485776 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/attn_stable_diffusion_unet_without_encoder_hidden_states_1.onnx b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/attn_stable_diffusion_unet_without_encoder_hidden_states_1.onnx new file mode 100644 index 000000000..edac45a8a --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/attn_stable_diffusion_unet_without_encoder_hidden_states_1.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e74b7617b0d12722078667564d66d29f4dfee8b52c129509e54e1965084099d +size 828905 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_0.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_0.pb new file mode 100644 index 000000000..c39d1f11e --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_0.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b433b528495798e9322a9df690e5a8d50d93f0c1c948cdbbd19d2276a4957bc +size 10485776 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_1.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_1.pb new file mode 100644 index 000000000..8885b2464 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_1.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4d7c62f9fbfb149662a81015333b573e2cee7cb2f0c512c9ac244a33dabebc7 +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_2.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_2.pb new file mode 100644 index 000000000..7f3ccba54 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_2.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf8d49cc028ae7df828200b3907e3c2a3229d23e1893eb5d50eb2e6aa57e01d5 +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_3.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_3.pb new file mode 100644 index 000000000..e03dc6b73 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_3.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a08b23c744b92bc8fd7461d294e8bd05884f72939d65a44d38a3602c2069090d +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_4.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_4.pb new file mode 100644 index 000000000..620f68f64 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_4.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bd9e0fa1651f9fc3758e8ac0996aa6fd78ad9e8d0a9511b67714da74963b7f7 +size 204812 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_5.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_5.pb new file mode 100644 index 000000000..44b3ee9ae --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/input_5.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0479dcf1030c4d21f8d03e9f519249a5e995a75875199cb42f2c6660dd07f2d +size 648 diff --git a/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/output_0.pb b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/output_0.pb new file mode 100644 index 000000000..32ed9e3b2 --- /dev/null +++ b/testdata/unittest_models/attn_stable_diffusion_unet_without_encoder_hidden_states_1/test_data_set_0/output_0.pb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b0c59e7f76909f0f04ac65827515b41f235715721400a3912a5cccf2015ea96 +size 10485776