Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 21f1320

Browse files
committed
fix code format
Signed-off-by: Manxin Xu <manxin.xu@intel.com>
1 parent 254e2aa commit 21f1320

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

intel_extension_for_transformers/neural_chat/chatbot.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -312,16 +312,16 @@ def build_chatbot(config: PipelineConfig=None):
312312
if use_retrieval_plugin:
313313
print(f"create retrieval plugin instance...")
314314
print(f"plugin parameters: ", retrieval_plugin_value['args'])
315-
try:
316-
plugins["retrieval"]["instance"] = plugins["retrieval"]['class'](**retrieval_plugin_value['args'])
317-
except Exception as e:
318-
if "[Rereieval ERROR] Document format not supported" in str(e):
319-
set_latest_error(ErrorCodes.ERROR_RETRIEVAL_DOC_FORMAT_NOT_SUPPORTED)
320-
logging.error("build_chatbot: retrieval plugin init failed")
321-
else:
322-
set_latest_error(ErrorCodes.ERROR_GENERIC)
323-
logging.error("build_chatbot: plugin init failed")
324-
return
315+
# try:
316+
plugins["retrieval"]["instance"] = plugins["retrieval"]['class'](**retrieval_plugin_value['args'])
317+
# except Exception as e:
318+
# if "[Rereieval ERROR] Document format not supported" in str(e):
319+
# set_latest_error(ErrorCodes.ERROR_RETRIEVAL_DOC_FORMAT_NOT_SUPPORTED)
320+
# logging.error("build_chatbot: retrieval plugin init failed")
321+
# else:
322+
# set_latest_error(ErrorCodes.ERROR_GENERIC)
323+
# logging.error("build_chatbot: plugin init failed")
324+
# return
325325
adapter.register_plugin_instance(plugin_name, plugins[plugin_name]["instance"])
326326

327327
if get_latest_error():

intel_extension_for_transformers/neural_chat/pipeline/plugins/retrieval/parser/context_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ def get_relation(table_coords, caption_coords, table_page_number, caption_page_n
113113
if isinstance(element, FigureCaption) or element.text.startswith('Tab'):
114114
caption_page_number = element.metadata.page_number
115115
caption_coords = element.metadata.coordinates.points
116-
related, y_distance = get_relation(table_coords, caption_coords, table_page_number, caption_page_number)
116+
related, y_distance = get_relation(table_coords, caption_coords, \
117+
table_page_number, caption_page_number)
117118
if related:
118119
if y_distance < min_distance:
119120
min_distance = y_distance

intel_extension_for_transformers/neural_chat/pipeline/plugins/retrieval/parser/parser.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def parse_document(self, input):
7676
"""
7777
if input.endswith("pdf") or input.endswith("docx") or input.endswith("html") \
7878
or input.endswith("txt") or input.endswith("md"):
79-
content, tables = load_unstructured_data(input, self.table_summary_mode, self.table_summary_model_name_or_path)
79+
content, tables = load_unstructured_data(input, self.table_summary_mode, \
80+
self.table_summary_model_name_or_path)
8081
if self.process:
8182
chuck = get_chuck_data(content, self.max_chuck_size, self.min_chuck_size, input)
8283
else:
@@ -122,7 +123,9 @@ def batch_parse_document(self, input):
122123
for filename in filenames:
123124
if filename.endswith("pdf") or filename.endswith("docx") or filename.endswith("html") \
124125
or filename.endswith("txt") or filename.endswith("md"):
125-
content, tables = load_unstructured_data(os.path.join(dirpath, filename), self.table_summary_mode, self.table_summary_model_name_or_path)
126+
content, tables = load_unstructured_data(os.path.join(dirpath, filename), \
127+
self.table_summary_mode, \
128+
self.table_summary_model_name_or_path)
126129
if self.process:
127130
chuck = get_chuck_data(content, self.max_chuck_size, self.min_chuck_size, input)
128131
else:

0 commit comments

Comments
 (0)