Download utils/functions.py from Code2aum/HRM_sudoku: direct link, hf CLI and curl.
- Browser
- Download file 516 Bytes
-
https://huggingface.co/Code2aum/HRM_sudoku/resolve/main/utils/functions.py
- Command line
-
hf download hf://Code2aum/HRM_sudoku/utils/functions.py
-
curl -L -o functions.py https://huggingface.co/Code2aum/HRM_sudoku/resolve/main/utils/functions.py
516 Bytes
| import importlib | |
| import inspect | |
| def load_model_class(identifier: str, prefix: str = "models."): | |
| module_path, class_name = identifier.split('@') | |
| # Import the module | |
| module = importlib.import_module(prefix + module_path) | |
| cls = getattr(module, class_name) | |
| return cls | |
| def get_model_source_path(identifier: str, prefix: str = "models."): | |
| module_path, class_name = identifier.split('@') | |
| module = importlib.import_module(prefix + module_path) | |
| return inspect.getsourcefile(module) | |