transformers
908f67e8 - fix: include transitive relative imports when loading from local directory (#46022)

Commit
47 days ago
fix: include transitive relative imports when loading from local directory (#46022) * fix: include transitive relative imports when loading from local directory When loading a custom model from a local folder with trust_remote_code=True, only direct relative imports of the entry-point file were copied into the module cache and included in the content hash. Transitive imports (i.e. imports of imports) were silently skipped, causing ImportError at runtime for any dependency beyond the first level. Fix both sites in the local branch to use get_relative_import_files, which already walks the full transitive closure. Also remove the now-unused module_file and modules_needed parameters from _compute_local_source_files_hash. * Update src/transformers/dynamic_module_utils.py --------- Co-authored-by: Matt <Rocketknight1@users.noreply.github.com>
Author
Parents
Loading