Fix path for dynamic module creation (#25402)

This commit is contained in:
Sylvain Gugger 2023-08-09 10:46:05 +02:00 committed by GitHub
parent 85447bb22e
commit 599377161b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,7 @@ def create_dynamic_module(name: Union[str, os.PathLike]):
Creates a dynamic module in the cache directory for modules.
"""
init_hf_modules()
dynamic_module_path = Path(HF_MODULES_CACHE) / name
dynamic_module_path = (Path(HF_MODULES_CACHE) / name).resolve()
# If the parent module does not exist yet, recursively create it.
if not dynamic_module_path.parent.exists():
create_dynamic_module(dynamic_module_path.parent)