From 0e1be93bb267662ec0900c95acac9615bd47a582 Mon Sep 17 00:00:00 2001 From: Mergen Nachin Date: Fri, 26 Jan 2024 08:32:23 -0800 Subject: [PATCH] Fix lint errors Reviewed By: larryliu0820 Differential Revision: D53131409 --- examples/apple/mps/CMakeLists.txt | 2 +- examples/apple/mps/scripts/mps_example.py | 17 ++++++----------- examples/models/llama2/export_llama.py | 4 ---- examples/models/llama2/llama_test.py | 8 ++------ 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/examples/apple/mps/CMakeLists.txt b/examples/apple/mps/CMakeLists.txt index d5a60a50e4c..879f59cd929 100644 --- a/examples/apple/mps/CMakeLists.txt +++ b/examples/apple/mps/CMakeLists.txt @@ -99,7 +99,7 @@ target_include_directories( list(TRANSFORM _mps_executor_runner__srcs PREPEND "${EXECUTORCH_ROOT}/") add_executable(mps_executor_runner ${_mps_executor_runner__srcs}) -if (CMAKE_BUILD_TYPE MATCHES "Debug") +if(CMAKE_BUILD_TYPE MATCHES "Debug") set(FLATCC_LIB flatcc_d) else() set(FLATCC_LIB flatcc) diff --git a/examples/apple/mps/scripts/mps_example.py b/examples/apple/mps/scripts/mps_example.py index d2b43698550..9b492148fdb 100644 --- a/examples/apple/mps/scripts/mps_example.py +++ b/examples/apple/mps/scripts/mps_example.py @@ -5,25 +5,20 @@ # Example script for exporting simple models to flatbuffer -import copy import argparse +import copy import logging import torch._export as export from executorch import exir from executorch.backends.apple.mps.mps_preprocess import MPSBackend from executorch.backends.apple.mps.partition.mps_partitioner import MPSPartitioner -from executorch.exir import EdgeCompileConfig -from executorch.exir import ( - EdgeCompileConfig, - EdgeProgramManager, -) -from executorch.sdk import generate_etrecord +from executorch.exir import EdgeCompileConfig, EdgeProgramManager from executorch.exir.backend.backend_api import to_backend from executorch.exir.backend.backend_details import CompileSpec from executorch.exir.capture._config import ExecutorchBackendConfig -from executorch.sdk import BundledProgram +from executorch.sdk import BundledProgram, generate_etrecord from executorch.sdk.bundled_program.config import MethodTestCase, MethodTestSuite from executorch.sdk.bundled_program.serialize import ( serialize_from_bundled_program_to_flatbuffer, @@ -154,8 +149,8 @@ program_buffer = executorch_program.buffer if args.generate_etrecord: - etrecord_path = "etrecord.bin" - logging.info("generating etrecord.bin") - generate_etrecord(etrecord_path, edge_program_manager_copy, executorch_program) + etrecord_path = "etrecord.bin" + logging.info("generating etrecord.bin") + generate_etrecord(etrecord_path, edge_program_manager_copy, executorch_program) save_pte_program(program_buffer, model_name) diff --git a/examples/models/llama2/export_llama.py b/examples/models/llama2/export_llama.py index 860449ea0b0..3d0d1b7bcfb 100644 --- a/examples/models/llama2/export_llama.py +++ b/examples/models/llama2/export_llama.py @@ -6,11 +6,7 @@ # Example script for exporting Llama2 to flatbuffer -import argparse -import json import logging -import os -import shlex import torch diff --git a/examples/models/llama2/llama_test.py b/examples/models/llama2/llama_test.py index b38669932d9..3382431e69b 100644 --- a/examples/models/llama2/llama_test.py +++ b/examples/models/llama2/llama_test.py @@ -6,16 +6,12 @@ import unittest -import torch - -from executorch.extension.pybindings import aten_lib - from .export_llama import build_model class LlamaTest(unittest.TestCase): def test_quantized_llama(self): - output_path = build_model( + _ = build_model( modelname="model", extra_opts="--fairseq2 -Q", par_local_output=True, @@ -23,7 +19,7 @@ def test_quantized_llama(self): ) def test_half_llama(self): - output_path = build_model( + _ = build_model( modelname="model", extra_opts="--fairseq2 -H", par_local_output=True,