From f68ca0acc08b729161d68ba5152feee37376b4b4 Mon Sep 17 00:00:00 2001 From: "seockho.kim" Date: Wed, 6 Aug 2025 09:30:47 +0900 Subject: [PATCH 1/9] Fuse LlamaRMSNorm class to RMSNorm op This commit fuse LlamaRMSNorm class to Circle RMSNorm op TICO-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- .../TinyLlamaWithFusedRMSNorm/__init__.py | 1 + .../model/TinyLlamaWithFusedRMSNorm/model.py | 45 +++++++++++++ .../requirements.txt | 1 + tico/serialize/operators/op_rmsnorm.py | 65 +++++++++++++++++++ tico/utils/register_custom_op.py | 24 +++++++ 5 files changed, 136 insertions(+) create mode 100644 test/modules/model/TinyLlamaWithFusedRMSNorm/__init__.py create mode 100644 test/modules/model/TinyLlamaWithFusedRMSNorm/model.py create mode 100644 test/modules/model/TinyLlamaWithFusedRMSNorm/requirements.txt create mode 100644 tico/serialize/operators/op_rmsnorm.py diff --git a/test/modules/model/TinyLlamaWithFusedRMSNorm/__init__.py b/test/modules/model/TinyLlamaWithFusedRMSNorm/__init__.py new file mode 100644 index 00000000..0c29109f --- /dev/null +++ b/test/modules/model/TinyLlamaWithFusedRMSNorm/__init__.py @@ -0,0 +1 @@ +# DO NOT REMOVE THIS FILE diff --git a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py new file mode 100644 index 00000000..cdd73408 --- /dev/null +++ b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py @@ -0,0 +1,45 @@ +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import torch +from transformers import AutoModelForCausalLM + +from test.modules.base import TestModuleBase + +from transformers.models.llama.modeling_llama import LlamaRMSNorm + +def llama_rmsnorm_forward_adapter(self: LlamaRMSNorm, hidden_states: torch.Tensor): + return torch.ops.circle_custom.rms_norm( + hidden_states, self.weight, self.variance_epsilon + ) + +LlamaRMSNorm.forward = llama_rmsnorm_forward_adapter + +class TinyLlamaWithFusedRMSNorm(TestModuleBase): + def __init__(self): + super().__init__() + self.model = AutoModelForCausalLM.from_pretrained("Maykeye/TinyLLama-v0").to( + "cpu" + ) + self.rtol = 1e-4 + self.atol = 1e-4 + + def forward(self, x): + return self.model(x) + + def get_example_inputs(self): + # >>> tokenizer = LlamaTokenizerFast.from_pretrained("huggyllama/llama-7b", legacy=True, from_slow=True) + # >>> tokenizer.encode("Hello .") # 869 is '▁.' + # [1, 15043, 29871, 1, 869] + return (torch.Tensor([[1, 15043, 29871, 1, 869]]).to(dtype=torch.int32),), {} diff --git a/test/modules/model/TinyLlamaWithFusedRMSNorm/requirements.txt b/test/modules/model/TinyLlamaWithFusedRMSNorm/requirements.txt new file mode 100644 index 00000000..5393938f --- /dev/null +++ b/test/modules/model/TinyLlamaWithFusedRMSNorm/requirements.txt @@ -0,0 +1 @@ +transformers>=4.50.1 diff --git a/tico/serialize/operators/op_rmsnorm.py b/tico/serialize/operators/op_rmsnorm.py new file mode 100644 index 00000000..808c6eed --- /dev/null +++ b/tico/serialize/operators/op_rmsnorm.py @@ -0,0 +1,65 @@ +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Dict, List, TYPE_CHECKING + +if TYPE_CHECKING: + import torch._ops + import torch.fx +import torch +from circle_schema import circle + +from tico.serialize.circle_graph import CircleSubgraph +from tico.serialize.operators.hashable_opcode import OpCode +from tico.serialize.operators.node_visitor import NodeVisitor, register_node_visitor +from tico.serialize.operators.utils import create_builtin_operator, get_op_index + + +@register_node_visitor +class RMSNormVisitor(NodeVisitor): + target: List[torch._ops.OpOverload] = [ + torch.ops.circle_custom.rms_norm.default, + ] + + def __init__(self, op_codes: Dict[OpCode, int], graph: CircleSubgraph): + super().__init__(op_codes, graph) + + def define_node( + self, + node: torch.fx.Node, + ) -> circle.Operator.OperatorT: + ( + input, + weight, + eps, + ) = node.args + + op_index = get_op_index( + circle.BuiltinOperator.BuiltinOperator.RMS_NORM, self._op_codes + ) + + inputs = [input, weight] + outputs = [node] + operator = create_builtin_operator(self.graph, op_index, inputs, outputs) + + # Op-specific option + operator.builtinOptionsType = ( + circle.BuiltinOptions.BuiltinOptions.RmsNormOptions + ) + option = circle.RmsNormOptions.RmsNormOptionsT() + option.epsilon = eps + + operator.builtinOptions = option + + return operator diff --git a/tico/utils/register_custom_op.py b/tico/utils/register_custom_op.py index 23dbc3d9..4d0e5c51 100644 --- a/tico/utils/register_custom_op.py +++ b/tico/utils/register_custom_op.py @@ -20,6 +20,7 @@ from tico.utils.mx.mx_ops import _quantize_mx + # Note that an operator assumes input tensor has NHWC format. def CircleResizeNearestNeighbor(): @custom_op("circle_custom::resize_nearest_neighbor", mutates_args=()) @@ -703,6 +704,28 @@ def _( return input_ +def CircleRMSNorm(): + @custom_op("circle_custom::rms_norm", mutates_args=()) + def rms_norm( + hidden_states: torch.Tensor, + weight: Optional[torch.Tensor] = None, + eps: float = 1e-05, + ) -> torch.Tensor: + input_dtype = hidden_states.dtype + hidden_states = hidden_states.to(torch.float32) + variance = hidden_states.pow(2).mean(-1, keepdim=True) + hidden_states = hidden_states * torch.rsqrt(variance + eps) + return weight * hidden_states.to(input_dtype) + + @register_fake("circle_custom::rms_norm") + def _( + hidden_states: torch.Tensor, + weight: Optional[torch.Tensor] = None, + eps: float = 1e-05, + ) -> torch.Tensor: + return hidden_states.new_empty(hidden_states.size()) + + # Add custom ops to the torch namespace def RegisterOps(): CircleResizeNearestNeighbor() @@ -715,3 +738,4 @@ def RegisterOps(): CircleAvgPool2D() CircleInstanceNorm() CircleQuantizeMX() + CircleRMSNorm() From 1512e0d3889b225c7917f9a17106fbcdd43e1354 Mon Sep 17 00:00:00 2001 From: "seockho.kim" Date: Wed, 6 Aug 2025 09:34:45 +0900 Subject: [PATCH 2/9] Fix format with lint This commit fixes format with lint. TICO-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- test/modules/model/TinyLlamaWithFusedRMSNorm/model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py index cdd73408..7aff53e1 100644 --- a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py +++ b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py @@ -15,17 +15,20 @@ import torch from transformers import AutoModelForCausalLM +from transformers.models.llama.modeling_llama import LlamaRMSNorm + from test.modules.base import TestModuleBase -from transformers.models.llama.modeling_llama import LlamaRMSNorm def llama_rmsnorm_forward_adapter(self: LlamaRMSNorm, hidden_states: torch.Tensor): return torch.ops.circle_custom.rms_norm( hidden_states, self.weight, self.variance_epsilon ) + LlamaRMSNorm.forward = llama_rmsnorm_forward_adapter + class TinyLlamaWithFusedRMSNorm(TestModuleBase): def __init__(self): super().__init__() From 1b624a7bf69a8c7649b836c8ae4e03ae5b9dbb5a Mon Sep 17 00:00:00 2001 From: "seockho.kim" Date: Wed, 6 Aug 2025 14:23:28 +0900 Subject: [PATCH 3/9] Apply PR review comments This applies review comments - It uses contextmanager - Useless format change removed - Custom RMSNorm Args defined. - register_dynamic_cache() added. TICO-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- .../model/TinyLlamaWithFusedRMSNorm/model.py | 23 ++++++++++++---- tico/serialize/operators/op_rmsnorm.py | 10 +++---- tico/utils/register_custom_op.py | 1 - tico/utils/validate_args_kwargs.py | 26 +++++++++++++++++++ 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py index 7aff53e1..84762f15 100644 --- a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py +++ b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py @@ -12,9 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from contextlib import contextmanager + import torch -from transformers import AutoModelForCausalLM +from tico.utils.pytree_utils import register_dynamic_cache + +from transformers import AutoModelForCausalLM from transformers.models.llama.modeling_llama import LlamaRMSNorm from test.modules.base import TestModuleBase @@ -26,17 +30,26 @@ def llama_rmsnorm_forward_adapter(self: LlamaRMSNorm, hidden_states: torch.Tenso ) -LlamaRMSNorm.forward = llama_rmsnorm_forward_adapter +@contextmanager +def patched_llama_rmsnorm(): + orig = LlamaRMSNorm.forward + LlamaRMSNorm.forward = llama_rmsnorm_forward_adapter + try: + yield + finally: + LlamaRMSNorm.forward = orig class TinyLlamaWithFusedRMSNorm(TestModuleBase): def __init__(self): super().__init__() - self.model = AutoModelForCausalLM.from_pretrained("Maykeye/TinyLLama-v0").to( - "cpu" - ) + with patched_llama_rmsnorm(): + self.model = AutoModelForCausalLM.from_pretrained( + "Maykeye/TinyLLama-v0" + ).to("cpu") self.rtol = 1e-4 self.atol = 1e-4 + register_dynamic_cache() def forward(self, x): return self.model(x) diff --git a/tico/serialize/operators/op_rmsnorm.py b/tico/serialize/operators/op_rmsnorm.py index 808c6eed..e296c390 100644 --- a/tico/serialize/operators/op_rmsnorm.py +++ b/tico/serialize/operators/op_rmsnorm.py @@ -24,6 +24,7 @@ from tico.serialize.operators.hashable_opcode import OpCode from tico.serialize.operators.node_visitor import NodeVisitor, register_node_visitor from tico.serialize.operators.utils import create_builtin_operator, get_op_index +from tico.utils.validate_args_kwargs import RMSNormCustomArgs @register_node_visitor @@ -39,11 +40,10 @@ def define_node( self, node: torch.fx.Node, ) -> circle.Operator.OperatorT: - ( - input, - weight, - eps, - ) = node.args + args = RMSNormCustomArgs(*node.args, **node.kwargs) # type: ignore[arg-type] + input = args.input + weight = args.weight + eps = args.eps op_index = get_op_index( circle.BuiltinOperator.BuiltinOperator.RMS_NORM, self._op_codes diff --git a/tico/utils/register_custom_op.py b/tico/utils/register_custom_op.py index 4d0e5c51..48372e0c 100644 --- a/tico/utils/register_custom_op.py +++ b/tico/utils/register_custom_op.py @@ -20,7 +20,6 @@ from tico.utils.mx.mx_ops import _quantize_mx - # Note that an operator assumes input tensor has NHWC format. def CircleResizeNearestNeighbor(): @custom_op("circle_custom::resize_nearest_neighbor", mutates_args=()) diff --git a/tico/utils/validate_args_kwargs.py b/tico/utils/validate_args_kwargs.py index 03f5e5b4..0db7fa78 100644 --- a/tico/utils/validate_args_kwargs.py +++ b/tico/utils/validate_args_kwargs.py @@ -931,6 +931,32 @@ class ResizeNearestNeighborArgs: size: List[int] +@enforce_type +@dataclass +class RMSNormArgs: + """ + rms_norm(Tensor input, SymInt[] normalized_shape, Tensor? weight=None, float? eps=None) -> Tensor + """ + + input: torch.fx.Node + normalized_shape: List[int] + weight: Optional[torch.fx.Node] + eps: Optional[float] + + +@enforce_type +@dataclass +class RMSNormCustomArgs: + """ + This is not aten ops but custom op for RMSNorm. + circle_custom.rms_norm(Tensor input, Tensor? weight=None, float? eps=None) -> Tensor + """ + + input: torch.fx.Node + weight: Optional[torch.fx.Node] + eps: Optional[float] + + @enforce_type @dataclass class RoundArgs: From 92549af17a94d72c18b6ea13dcca4d6ba1ce65af Mon Sep 17 00:00:00 2001 From: "seockho.kim" Date: Wed, 6 Aug 2025 16:56:22 +0900 Subject: [PATCH 4/9] Applied review comments This commit applies the review comments. - RMSNormCustomArgs is changed to CircleRMSNormArgs - Patcher is moved to tico utils from test. TICO-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- .../model/TinyLlamaWithFusedRMSNorm/model.py | 20 +---------- tico/serialize/operators/op_rmsnorm.py | 4 +-- tico/utils/patcher.py | 36 +++++++++++++++++++ tico/utils/validate_args_kwargs.py | 26 +++++++------- 4 files changed, 52 insertions(+), 34 deletions(-) create mode 100644 tico/utils/patcher.py diff --git a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py index 84762f15..7fc7edac 100644 --- a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py +++ b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py @@ -12,34 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -from contextlib import contextmanager - import torch +from tico.utils.patcher import patched_llama_rmsnorm from tico.utils.pytree_utils import register_dynamic_cache from transformers import AutoModelForCausalLM -from transformers.models.llama.modeling_llama import LlamaRMSNorm from test.modules.base import TestModuleBase -def llama_rmsnorm_forward_adapter(self: LlamaRMSNorm, hidden_states: torch.Tensor): - return torch.ops.circle_custom.rms_norm( - hidden_states, self.weight, self.variance_epsilon - ) - - -@contextmanager -def patched_llama_rmsnorm(): - orig = LlamaRMSNorm.forward - LlamaRMSNorm.forward = llama_rmsnorm_forward_adapter - try: - yield - finally: - LlamaRMSNorm.forward = orig - - class TinyLlamaWithFusedRMSNorm(TestModuleBase): def __init__(self): super().__init__() diff --git a/tico/serialize/operators/op_rmsnorm.py b/tico/serialize/operators/op_rmsnorm.py index e296c390..835141e4 100644 --- a/tico/serialize/operators/op_rmsnorm.py +++ b/tico/serialize/operators/op_rmsnorm.py @@ -24,7 +24,7 @@ from tico.serialize.operators.hashable_opcode import OpCode from tico.serialize.operators.node_visitor import NodeVisitor, register_node_visitor from tico.serialize.operators.utils import create_builtin_operator, get_op_index -from tico.utils.validate_args_kwargs import RMSNormCustomArgs +from tico.utils.validate_args_kwargs import CircleRMSNormArgs @register_node_visitor @@ -40,7 +40,7 @@ def define_node( self, node: torch.fx.Node, ) -> circle.Operator.OperatorT: - args = RMSNormCustomArgs(*node.args, **node.kwargs) # type: ignore[arg-type] + args = CircleRMSNormArgs(*node.args, **node.kwargs) # type: ignore[arg-type] input = args.input weight = args.weight eps = args.eps diff --git a/tico/utils/patcher.py b/tico/utils/patcher.py new file mode 100644 index 00000000..f1685dd1 --- /dev/null +++ b/tico/utils/patcher.py @@ -0,0 +1,36 @@ +# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from contextlib import contextmanager + +import torch + +from transformers.models.llama.modeling_llama import LlamaRMSNorm + + +def llama_rmsnorm_forward_adapter(self: LlamaRMSNorm, hidden_states: torch.Tensor): + return torch.ops.circle_custom.rms_norm( + hidden_states, self.weight, self.variance_epsilon + ) + + +@contextmanager +def patched_llama_rmsnorm(): + orig = LlamaRMSNorm.forward + LlamaRMSNorm.forward = llama_rmsnorm_forward_adapter + try: + yield + finally: + LlamaRMSNorm.forward = orig + diff --git a/tico/utils/validate_args_kwargs.py b/tico/utils/validate_args_kwargs.py index 0db7fa78..f6badfff 100644 --- a/tico/utils/validate_args_kwargs.py +++ b/tico/utils/validate_args_kwargs.py @@ -171,6 +171,19 @@ class CatArgs: dim: int = 0 +@enforce_type +@dataclass +class CircleRMSNormArgs: + """ + This is not aten ops but custom op for RMSNorm. + circle_custom.rms_norm(Tensor input, Tensor? weight=None, float? eps=None) -> Tensor + """ + + input: torch.fx.Node + weight: Optional[torch.fx.Node] + eps: Optional[float] + + @enforce_type @dataclass class ClampArgs: @@ -944,19 +957,6 @@ class RMSNormArgs: eps: Optional[float] -@enforce_type -@dataclass -class RMSNormCustomArgs: - """ - This is not aten ops but custom op for RMSNorm. - circle_custom.rms_norm(Tensor input, Tensor? weight=None, float? eps=None) -> Tensor - """ - - input: torch.fx.Node - weight: Optional[torch.fx.Node] - eps: Optional[float] - - @enforce_type @dataclass class RoundArgs: From a150959f4c591a32ef49b6661ad3debaca88c63f Mon Sep 17 00:00:00 2001 From: "seockho.kim" Date: Wed, 6 Aug 2025 17:02:06 +0900 Subject: [PATCH 5/9] Fix format with linter. This commit fixes format error. TICO-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- tico/utils/patcher.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tico/utils/patcher.py b/tico/utils/patcher.py index f1685dd1..7806f1ea 100644 --- a/tico/utils/patcher.py +++ b/tico/utils/patcher.py @@ -33,4 +33,3 @@ def patched_llama_rmsnorm(): yield finally: LlamaRMSNorm.forward = orig - From bc5414c8d927358206c5b24e0537c512700dd5d7 Mon Sep 17 00:00:00 2001 From: "seockho.kim" Date: Fri, 8 Aug 2025 11:32:17 +0900 Subject: [PATCH 6/9] Updated to assign transformers version This commit assigns exact transformers version. It cannot work with latest version(ex.4.53) TICO-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- test/modules/model/TinyLlamaWithFusedRMSNorm/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/modules/model/TinyLlamaWithFusedRMSNorm/requirements.txt b/test/modules/model/TinyLlamaWithFusedRMSNorm/requirements.txt index 5393938f..1e4043b8 100644 --- a/test/modules/model/TinyLlamaWithFusedRMSNorm/requirements.txt +++ b/test/modules/model/TinyLlamaWithFusedRMSNorm/requirements.txt @@ -1 +1 @@ -transformers>=4.50.1 +transformers==4.52.4 From 5e137ed5e800ccf2d951fbb2ebcfa7434917efa5 Mon Sep 17 00:00:00 2001 From: "seockho.kim" Date: Fri, 8 Aug 2025 14:41:48 +0900 Subject: [PATCH 7/9] Refactor RMSNorm utilities and update imports - Move patcher.py to serialize/operators/adapters/rmsnorm.py TICO-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- test/modules/model/TinyLlamaWithFusedRMSNorm/model.py | 2 +- .../patcher.py => serialize/operators/adapters/rmsnorm.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tico/{utils/patcher.py => serialize/operators/adapters/rmsnorm.py} (100%) diff --git a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py index 7fc7edac..d370006f 100644 --- a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py +++ b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py @@ -14,7 +14,7 @@ import torch -from tico.utils.patcher import patched_llama_rmsnorm +from tico.serialize.operators.adapters.rmsnorm import patched_llama_rmsnorm from tico.utils.pytree_utils import register_dynamic_cache from transformers import AutoModelForCausalLM diff --git a/tico/utils/patcher.py b/tico/serialize/operators/adapters/rmsnorm.py similarity index 100% rename from tico/utils/patcher.py rename to tico/serialize/operators/adapters/rmsnorm.py From 9253951b17955a9f8e99b70d1fe8bceb45352fa6 Mon Sep 17 00:00:00 2001 From: "seockho.kim" Date: Fri, 8 Aug 2025 14:56:17 +0900 Subject: [PATCH 8/9] Add __init__.py to adapter folder This adds __init__.py to adapter folder to make it a package. TICO-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- tico/serialize/operators/adapters/__init__.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 tico/serialize/operators/adapters/__init__.py diff --git a/tico/serialize/operators/adapters/__init__.py b/tico/serialize/operators/adapters/__init__.py new file mode 100644 index 00000000..0c29109f --- /dev/null +++ b/tico/serialize/operators/adapters/__init__.py @@ -0,0 +1 @@ +# DO NOT REMOVE THIS FILE From 6826bb7376312a650c07dd313e601253feead1aa Mon Sep 17 00:00:00 2001 From: "seockho.kim" Date: Mon, 11 Aug 2025 10:00:58 +0900 Subject: [PATCH 9/9] Renamed rmsnorm adapter file This commit renamed rmsnorm adapter file to llama_rmsnorm.py TICO-DCO-1.0-Signed-off-by: Seockho Kim seockho.kim@samsung.com --- test/modules/model/TinyLlamaWithFusedRMSNorm/model.py | 2 +- .../operators/adapters/{rmsnorm.py => llama_rmsnorm.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tico/serialize/operators/adapters/{rmsnorm.py => llama_rmsnorm.py} (100%) diff --git a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py index d370006f..c2af79e3 100644 --- a/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py +++ b/test/modules/model/TinyLlamaWithFusedRMSNorm/model.py @@ -14,7 +14,7 @@ import torch -from tico.serialize.operators.adapters.rmsnorm import patched_llama_rmsnorm +from tico.serialize.operators.adapters.llama_rmsnorm import patched_llama_rmsnorm from tico.utils.pytree_utils import register_dynamic_cache from transformers import AutoModelForCausalLM diff --git a/tico/serialize/operators/adapters/rmsnorm.py b/tico/serialize/operators/adapters/llama_rmsnorm.py similarity index 100% rename from tico/serialize/operators/adapters/rmsnorm.py rename to tico/serialize/operators/adapters/llama_rmsnorm.py