Creates the cache directory for modules with an init, and adds it to the Python path.
()
| 50 | |
| 51 | |
| 52 | def 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 | |
| 67 | def create_dynamic_module(name: str | os.PathLike): |
no test coverage detected
searching dependent graphs…