Skip to content

Commit

Permalink
ruff fix to core import logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sambhavnoobcoder committed Jan 23, 2025
1 parent 05ca48f commit d66fdbf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transformers/utils/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2283,15 +2283,15 @@ def clear_import_cache():
mod_name for mod_name in sys.modules
if mod_name.startswith('transformers.')
]

# Remove them from sys.modules
for mod_name in transformers_modules:
module = sys.modules[mod_name]
# Clear _LazyModule caches if applicable
if isinstance(module, _LazyModule):
module._objects = {} # Clear cached objects
del sys.modules[mod_name]

# Force reload main transformers module
if 'transformers' in sys.modules:
main_module = sys.modules['transformers']
Expand Down

0 comments on commit d66fdbf

Please sign in to comment.