From 22957aad5cb010759e2522f158e407171e5739a0 Mon Sep 17 00:00:00 2001 From: kaiyaointel Date: Thu, 29 Dec 2022 14:34:31 +0800 Subject: [PATCH 1/3] Update handle_user_input.py --- neural_coder/utils/handle_user_input.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/neural_coder/utils/handle_user_input.py b/neural_coder/utils/handle_user_input.py index d1f14e7f84e..2d65d638167 100644 --- a/neural_coder/utils/handle_user_input.py +++ b/neural_coder/utils/handle_user_input.py @@ -100,8 +100,11 @@ def get_imports_path(user_code_path: List) -> List: "classy_vision", "collections", "contextlib", - "datasets", + "data", "dataclasses", + "dataloader", + "dataset", + "datasets", "einops", "enum", "evaluate", @@ -112,13 +115,17 @@ def get_imports_path(user_code_path: List) -> List: "importlib", "inspect", "intel_extension_for_pytorch", + "itertools", "jax", "json", "keras", "libcst", "linecache", "logging", + "loggings", "math", + "model", + "models", "neural_coder", "neural_compressor", "numpy", @@ -131,6 +138,7 @@ def get_imports_path(user_code_path: List) -> List: "shutil", "subprocess", "sys", + "system", "tempfile", "typing", "tensorflow", @@ -141,11 +149,15 @@ def get_imports_path(user_code_path: List) -> List: "torchdynamo", "tqdm", "traceback", + "trainer_qa", "unittest", + "utils_qa", "vissl", + "warning", "warnings", "packaging", "pytorch_lightning", + "__future__", ] if globals.cache_load_transformers: From 09e2f6d5d19f8e25848a591e09e447cab9469f1c Mon Sep 17 00:00:00 2001 From: kaiyaointel Date: Thu, 29 Dec 2022 14:35:21 +0800 Subject: [PATCH 2/3] Update function.py --- neural_coder/graphers/function.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/neural_coder/graphers/function.py b/neural_coder/graphers/function.py index 4c554dc6c17..dfef282d48f 100644 --- a/neural_coder/graphers/function.py +++ b/neural_coder/graphers/function.py @@ -79,8 +79,11 @@ def c(): # judge_1: indent is equal to def indent judge_1 = following_indent_level <= def_indent_level # judge_2: not starting with")" - judge_2 = True if ( - following_line != "" and following_line[following_indent_level] != ")") else False + try: + judge_2 = True if ( + following_line != "" and following_line[following_indent_level] != ")") else False + except: + judge_2 = False # judge_3: is not a comment c1 = False c2 = False From e709aa84688d897565cc3ec71323e5393c9b036d Mon Sep 17 00:00:00 2001 From: kaiyaointel Date: Thu, 29 Dec 2022 14:35:46 +0800 Subject: [PATCH 3/3] Update code_line.py --- neural_coder/graphers/code_line.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/neural_coder/graphers/code_line.py b/neural_coder/graphers/code_line.py index a937312f745..966d2d7c55c 100644 --- a/neural_coder/graphers/code_line.py +++ b/neural_coder/graphers/code_line.py @@ -152,8 +152,11 @@ def register_code_line(): # judge_1: indent is equal to def indent judge_1 = following_indent_level <= class_def_indent_level # judge_2: not starting with")" - judge_2 = True if ( - following_line != "" and following_line[following_indent_level] != ")") else False + try: + judge_2 = True if ( + following_line != "" and following_line[following_indent_level] != ")") else False + except: + judge_2 = False # judge_3: is not a comment or empty line judge_3 = True if ( not _is_multi_line_comment and not _is_single_line_comment_or_empty) else False @@ -216,8 +219,11 @@ def register_code_line(): # judge_1: indent is equal to def indent judge_1 = following_indent_level <= func_def_indent_level # judge_2: not starting with")" - judge_2 = True if ( - following_line != "" and following_line[following_indent_level] != ")") else False + try: + judge_2 = True if ( + following_line != "" and following_line[following_indent_level] != ")") else False + except: + judge_2 = False # judge_3: is not a comment or empty line judge_3 = True if ( not _is_multi_line_comment and not _is_single_line_comment_or_empty) else False