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

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. Creates a dynamic module in the cache directory for modules.
""" """
init_hf_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 the parent module does not exist yet, recursively create it.
if not dynamic_module_path.parent.exists(): if not dynamic_module_path.parent.exists():
create_dynamic_module(dynamic_module_path.parent) create_dynamic_module(dynamic_module_path.parent)