TheWeeeed commited on
Commit
c065a00
·
verified ·
1 Parent(s): 4886d7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -306,9 +306,18 @@ def two_stage_qa(question, candidate_paragraphs_str, max_seq_len_mc=512, max_seq
306
  if len(qa_features_dataset) == 0:
307
  return "錯誤: 無法為選定段落生成QA特徵 (可能段落太短或內容問題)。", f"選中的段落 (索引 {selected_idx}):\n{selected_paragraph}", "N/A"
308
 
309
- logger.info(f"--- In two_stage_qa, about to create DataLoader for question_id: {question_id} ---")
 
 
 
 
 
 
 
 
310
  logger.info(f"Number of features in qa_features_dataset: {len(qa_features_dataset)}")
311
 
 
312
  for i in range(len(qa_features_dataset)):
313
  feature_item = qa_features_dataset[i]
314
  logger.info(f" Inspecting feature {i} from qa_features_dataset:")
 
306
  if len(qa_features_dataset) == 0:
307
  return "錯誤: 無法為選定段落生成QA特徵 (可能段落太短或內容問題)。", f"選中的段落 (索引 {selected_idx}):\n{selected_paragraph}", "N/A"
308
 
309
+ # 為了日誌,我們使用傳入的問題文本作為一個標識(或者您可以生成一個隨機ID)
310
+ # 如果您的 qa_features_dataset['example_id'] 包含有意義的ID,也可以從那裡獲取
311
+ # 由於您在 prepare_features_for_qa_inference_gradio 中硬編碼了 "temp_id",這裡也用它
312
+ log_question_id = "temp_id"
313
+ if 'example_id' in qa_features_dataset.features and len(qa_features_dataset) > 0:
314
+ log_question_id = qa_features_dataset[0]['example_id'] # 獲取第一個特徵的 example_id
315
+
316
+
317
+ logger.info(f"--- In two_stage_qa, about to create DataLoader for question_id: {log_question_id} ---")
318
  logger.info(f"Number of features in qa_features_dataset: {len(qa_features_dataset)}")
319
 
320
+
321
  for i in range(len(qa_features_dataset)):
322
  feature_item = qa_features_dataset[i]
323
  logger.info(f" Inspecting feature {i} from qa_features_dataset:")