Skip to content

Fix None issue in reorganizer queue#124

Closed
J1awei-Yang wants to merge 1 commit intoMemTensor:devfrom
J1awei-Yang:fix/reorganizer_queue
Closed

Fix None issue in reorganizer queue#124
J1awei-Yang wants to merge 1 commit intoMemTensor:devfrom
J1awei-Yang:fix/reorganizer_queue

Conversation

@J1awei-Yang
Copy link
Collaborator

@J1awei-Yang J1awei-Yang commented Jul 18, 2025

Description

Summary: (summary)
fix the None type in minheap of reorganizer.

Reviewer: @CaralHsi

Checklist:

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have added necessary documentation (if applicable) | 我已添加必要的文档(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

Copilot AI review requested due to automatic review settings July 18, 2025 07:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds implementation files for the MMLongBench-Doc benchmark for evaluating long-context document understanding with visualizations. The PR includes model integration files for multiple LVLMs (Large Vision Language Models), evaluation utilities, and documentation.

  • Adds run_api.py for API-based model execution with MOS (Memory Operating System) integration
  • Implements model wrappers for three LVLM architectures: MiniCPM-Llama3, InternVL-Chat, and InternLM-XComposer2-4KHD
  • Provides evaluation framework with answer extraction, scoring, and prompt templates
  • Includes comprehensive README documentation with setup instructions and usage examples

Reviewed Changes

Copilot reviewed 8 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
MMLongBench-Doc/run_api.py Main API runner integrating MOS memory system for document processing and evaluation
MMLongBench-Doc/models/minicpm_llama3.py Model wrapper for MiniCPM-Llama3-V-2.5 vision-language model
MMLongBench-Doc/models/internvl_chat.py Model wrapper for InternVL-Chat with dynamic image preprocessing
MMLongBench-Doc/models/internlm_xc2_4khd.py Model wrapper for InternLM-XComposer2-4KHD with high-definition image support
MMLongBench-Doc/eval/prompt_for_answer_extraction.md Prompt template for extracting structured answers from model responses
MMLongBench-Doc/eval/extract_answer.py OpenAI API client for answer extraction using GPT-4o
MMLongBench-Doc/eval/eval_score.py Comprehensive evaluation utilities for scoring different answer types
MMLongBench-Doc/README.md Project documentation with setup instructions and usage examples

mos.clear_messages()
response = mos.chat(messages)
is_success = True
except:
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using bare except clause is not recommended. Consider catching specific exceptions or at minimum use 'except Exception:' to avoid catching system-exiting exceptions like KeyboardInterrupt.

Suggested change
except:
except Exception:

Copilot uses AI. Check for mistakes.

try:
from transformers.generation.streamers import BaseStreamer
except: # noqa # pylint: disable=bare-except
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although there are disable comments, using bare except is still not recommended. Consider catching ImportError specifically since this appears to be handling an optional import.

Suggested change
except: # noqa # pylint: disable=bare-except
except ImportError: # noqa

Copilot uses AI. Check for mistakes.
reference = float(str(reference).strip().rstrip("%").strip())
try:
prediction = float(str(prediction).strip().rstrip("%").strip())
except:
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using bare except clause is not recommended. Consider catching ValueError or TypeError specifically since this is handling float conversion.

Suggested change
except:
except (ValueError, TypeError):

Copilot uses AI. Check for mistakes.
if answer_type == "Int":
try:
gt, pred = int(gt), int(float(pred))
except:
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using bare except clause is not recommended. Consider catching ValueError or TypeError specifically since this is handling type conversions.

Suggested change
except:
except (ValueError, TypeError):

Copilot uses AI. Check for mistakes.
try:
gt = float(get_clean_string(str(gt)))
pred = float(get_clean_string(str(pred)))
except:
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using bare except clause is not recommended. Consider catching ValueError or TypeError specifically since this is handling float conversion.

Suggested change
except:
except (ValueError, TypeError):

Copilot uses AI. Check for mistakes.
]
) / len([sample for sample in evaluated_samples if sample["pred"] != "Not answerable"])
f1 = 2 * recall * precision / (recall + precision) if (recall + precision) > 0.0 else 0.0
except:
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using bare except clause is not recommended. Consider catching ZeroDivisionError specifically since this is handling division operations.

Suggested change
except:
except (ZeroDivisionError, ValueError):

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants