mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-26 16:35:05 +00:00
9 lines
288 B
Python
9 lines
288 B
Python
import importlib.util
|
|
|
|
|
|
def load_class_from_file(file_path: str, class_name: str) -> type:
|
|
spec = importlib.util.spec_from_file_location("module", file_path)
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return getattr(module, class_name)
|