Skip to content

fix missing import - #320

Merged
shijieliu merged 1 commit into
NVIDIA:mainfrom
gameofdimension:patch-2
Mar 11, 2026
Merged

shijieliu merged 1 commit into
NVIDIA:mainfrom
gameofdimension:patch-2

Conversation

@gameofdimension

Copy link
Copy Markdown
Contributor

fix missing import of logging, which is used at line 149

logging.warning(f"DynamicEmb Overwriting existing files in {path}")

Description

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Added logging import to enable logging functionality.
@greptile-apps

greptile-apps Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds the missing import logging statement to corelib/dynamicemb/dynamicemb/dump_load.py, which is a one-line bug fix that prevents a NameError when logging.warning() is called at line 150 during an overwrite operation in DynamicEmbDump.

  • Adds import logging alongside the existing standard-library imports (os, warnings)
  • The fix directly resolves the NameError: name 'logging' is not defined that would be raised when DynamicEmbDump is called with allow_overwrite=True on an existing non-empty directory

Confidence Score: 5/5

  • This PR is safe to merge — it is a minimal, correct fix for a missing standard-library import.
  • The change is a single-line addition of a standard Python library import. The logging module is used exactly once in the file and import logging is the correct, idiomatic way to fix the issue. There are no side effects, no logic changes, and no risk of regression.
  • No files require special attention.

Important Files Changed

Filename Overview
corelib/dynamicemb/dynamicemb/dump_load.py Adds the missing import logging statement so the logging.warning() call at line 150 no longer raises a NameError at runtime.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["DynamicEmbDump called"] --> B{"Path exists?"}
    B -- No --> C["os.makedirs(path)"]
    B -- Yes --> D{"Is directory?"}
    D -- No --> E["Raise Exception"]
    D -- Yes --> F{"Directory empty?"}
    F -- Yes --> G["Continue"]
    F -- No --> H{"allow_overwrite?"}
    H -- No --> I["Raise Exception"]
    H -- Yes --> J["logging.warning(overwrite message)"]
    J --> G
    C --> G
    G --> K["dist.barrier()"]
    K --> L["find_sharded_modules()"]
    L --> M["Dump embedding tables"]
Loading

Last reviewed commit: 1e0b2dc

@shijieliu

Copy link
Copy Markdown
Collaborator

thanks for your contribution!

@shijieliu
shijieliu merged commit 0a81e77 into NVIDIA:main Mar 11, 2026
@gameofdimension
gameofdimension deleted the patch-2 branch March 11, 2026 02:53
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