MCPcopy Index your code
hub / github.com/huggingface/diffusers / init_hf_modules

Function init_hf_modules

src/diffusers/utils/dynamic_modules_utils.py:52–64  ·  view source on GitHub ↗

Creates the cache directory for modules with an init, and adds it to the Python path.

()

Source from the content-addressed store, hash-verified

50
51
52def init_hf_modules():
53 """
54 Creates the cache directory for modules with an init, and adds it to the Python path.
55 """
56 # This function has already been executed if HF_MODULES_CACHE already is in the Python path.
57 if HF_MODULES_CACHE in sys.path:
58 return
59
60 sys.path.append(HF_MODULES_CACHE)
61 os.makedirs(HF_MODULES_CACHE, exist_ok=True)
62 init_path = Path(HF_MODULES_CACHE) / "__init__.py"
63 if not init_path.exists():
64 init_path.touch()
65
66
67def create_dynamic_module(name: str | os.PathLike):

Callers 1

create_dynamic_moduleFunction · 0.85

Calls 1

existsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…