From de22a2d4ffd382dddbd8d6b698162fa27b14b77b Mon Sep 17 00:00:00 2001 From: Ceceliachenen Date: Mon, 25 Nov 2024 15:12:50 +0800 Subject: [PATCH] fix_multimodal_eval_pipeline (#280) --- .../evaluation/generator/multimodal_qca_generator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pai_rag/evaluation/generator/multimodal_qca_generator.py b/src/pai_rag/evaluation/generator/multimodal_qca_generator.py index f1fec9bb..2aa50326 100644 --- a/src/pai_rag/evaluation/generator/multimodal_qca_generator.py +++ b/src/pai_rag/evaluation/generator/multimodal_qca_generator.py @@ -84,10 +84,10 @@ async def agenerate_predicted_qca_dataset(self, rag_qca_dataset): async def agenerate_predicted_multimodal_qca_sample( self, qca_sample, **response_kwargs: Any ): - image_url_list = qca_sample.reference_image_url_list + image_url_list = qca_sample.reference_image_url_list or [] image_documents = load_image_urls(image_url_list) image_context_str = "\n\n".join(image_url_list) - reference_contexts = qca_sample.reference_contexts + reference_contexts = qca_sample.reference_contexts or [] text_context_str = "\n\n".join(reference_contexts) query_str = qca_sample.query context_str = f"{text_context_str}\n\n图片链接列表: \n\n{image_context_str}\n\n" @@ -107,7 +107,7 @@ async def agenerate_predicted_multimodal_qca_sample( return qca_sample async def agenerate_predicted_qca_sample(self, qca_sample, **response_kwargs: Any): - reference_contexts = qca_sample.reference_contexts + reference_contexts = qca_sample.reference_contexts or [] text_context_str = "\n\n".join(reference_contexts) query_str = qca_sample.query text_qa_template = self._text_qa_template.partial_format(query_str=query_str)