File tree Expand file tree Collapse file tree 9 files changed +7
-13
lines changed Expand file tree Collapse file tree 9 files changed +7
-13
lines changed Original file line number Diff line number Diff line change 99
1010import torch
1111from executorch .backends .samsung .utils .constants import QuantConstants
12- from executorch .backends .samsung .utils .utils import is_graph_input
1312from executorch .exir .dialects ._ops import ops as exir_ops
1413from executorch .exir .pass_base import ExportPass , PassResult
1514from torch ._export .utils import get_buffer
Original file line number Diff line number Diff line change 2020 op_expand_copy ,
2121 op_gelu ,
2222 op_getitem ,
23+ op_hardsigmoid ,
2324 op_hardswish ,
2425 op_hardtanh ,
25- op_hardsigmoid ,
2626 op_layer_norm ,
2727 op_leaky_relu ,
2828 op_linear ,
Original file line number Diff line number Diff line change 1212 register_node_visitor ,
1313)
1414from executorch .backends .samsung .serialization .enn_graph_schema import EnnGraph
15- from executorch .backends .samsung .utils .constants import QuantConstants
1615
1716
1817@register_node_visitor
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ def define_node(
4343 all_input_tensors .append (bias_id )
4444
4545 weight_shape = get_shape (weight_node )
46- params = {"in_channels" : weight_shape [1 ], "out_channels" : weight_shape [0 ]}
46+ params = {"in_channels" : weight_shape [1 ], "out_channels" : weight_shape [0 ]}
4747 self ._update_params_qdtype (node , params )
4848
4949 output_id = self .define_tensor (node , enn_graph , vals_to_ids )
Original file line number Diff line number Diff line change 99
1010import executorch .backends .samsung .python .PyEnnWrapperAdaptor as PyEnnWrapper
1111import torch
12+ from executorch .backends .samsung ._passes .annotate_qparams import AnnotateQparamsPass
1213from executorch .backends .samsung ._passes .annotate_scalar_parameters import (
1314 AnnotateScalarParametersPass ,
1415)
1516from executorch .backends .samsung ._passes .conv1d_to_conv2d import Conv1dToConv2d
1617from executorch .backends .samsung ._passes .customized_constant_prop import (
1718 ConstantPropPass ,
1819)
19- from executorch .backends .samsung ._passes .annotate_qparams import AnnotateQparamsPass
2020from executorch .backends .samsung ._passes .fold_qdq import FoldQDQPass
2121from executorch .backends .samsung ._passes .insert_qdq import InsertQDQPass
2222from executorch .backends .samsung ._passes .replace_scalar_ops import ReplaceOpsWithScalar
Original file line number Diff line number Diff line change 1212import numpy as np
1313
1414import torch
15- from executorch .backends .samsung ._passes .utils import none_quant_tensor_quant_meta
1615from executorch .backends .samsung .builders .utils import DATA_TYPE_STR_MAPPING
1716from executorch .backends .samsung .utils .constants import QuantConstants
1817from executorch .backends .samsung .utils .utils import quantize_tensor
Original file line number Diff line number Diff line change 1717 DecomposeScaledDotProductAttention ,
1818)
1919from executorch .backends .transforms .remove_clone_ops import RemoveCloneOpsTransform
20- from executorch .exir import EdgeCompileConfig , ExportedProgram
20+ from executorch .exir import EdgeCompileConfig
2121from executorch .exir .backend .backend_details import CompileSpec
2222from executorch .exir .dialects ._ops import ops as exir_ops
2323from executorch .exir .pass_manager import PassType
24- from executorch .exir .program ._program import (
25- to_edge_transform_and_lower ,
26- )
24+ from executorch .exir .program ._program import to_edge_transform_and_lower
2725from torchao .quantization .pt2e .quantize_pt2e import convert_pt2e , prepare_pt2e
2826
2927
Original file line number Diff line number Diff line change 1212from executorch .exir .backend .backend_details import CompileSpec
1313from executorch .exir .dialects ._ops import ops as exir_ops
1414
15- from torch ._decomp import core_aten_decompositions as torch_core_aten_decompositions
1615from torch .export .exported_program import ExportedProgram
1716
1817
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ def get_dataset(
168168 help = ("Whether to dump all outputs. If not set, we only dump pte." ),
169169 type = bool ,
170170 )
171-
171+
172172 parser .add_argument (
173173 "-w" ,
174174 "--weight" ,
@@ -196,7 +196,7 @@ def get_dataset(
196196 instance .vocab_size = 29
197197 model = instance .get_eager_model ().eval ()
198198 if args .weight :
199- weight = torch .load (args .weight )
199+ weight = torch .load (args .weight , weights_only = True )
200200 model .load_state_dict (weight )
201201 assert args .calibration_number
202202 if args .dataset :
You can’t perform that action at this time.
0 commit comments