Skip to content

fix(research): resolve undefined names (tqdm import, raw_size_to_cache) - #1640

Open
sarankumar1325 wants to merge 1 commit into
FlagOpen:masterfrom
sarankumar1325:fix/research-undefined-names
Open

sarankumar1325 wants to merge 1 commit into
FlagOpen:masterfrom
sarankumar1325:fix/research-undefined-names

Conversation

@sarankumar1325

Copy link
Copy Markdown

What

Two NameErrors in research/ code, found with ruff --select F821:

  1. research/BGE_Coder/evaluation/coderag_eval/test/create/utils.py: cost_esitmate() calls tqdm(...) but the module never imports it (the sibling scripts in that folder do from tqdm import tqdm).
  2. research/Long_LLM/activation_beacon/src/modeling_beacon.py: Memory.update guards with if self._raw_size_to_cache > 0: and then slices with start=-raw_size_to_cache, a name that is not defined in that method (the same-named locals live in forward). It now reads self._raw_size_to_cache, so the raw-KV branch no longer raises NameError.

Verification

ruff check --select F821 is clean on both files after the change (it reported the three undefined-name errors before), and both files compile. These are research scripts that need GPUs/checkpoints and have no tests in the repo (tests/ only covers the FlagEmbedding package), so I did not add a test.

Notes

Not overlapping with #1638 (tokenizer in save_merged_model).

AI assistance

This PR was prepared with AI assistance (Grok Bot, on behalf of @sarankumar1325).

…vation_beacon

- coderag_eval/test/create/utils.py: cost_esitmate used tqdm without importing it.
- activation_beacon/src/modeling_beacon.py: Memory.update used the undefined local
  raw_size_to_cache; it must read self._raw_size_to_cache, like the condition just above.

Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant