summaryrefslogtreecommitdiff
path: root/trm/utils/functions.py
diff options
context:
space:
mode:
authorYurenHao0426 <blackhao0426@gmail.com>2026-06-13 12:35:36 -0500
committerYurenHao0426 <blackhao0426@gmail.com>2026-06-13 12:35:36 -0500
commit66e0d8b9fd4d0f7a2231d689c055e26fdf1cf04a (patch)
treec29cba61124018755a19b02c9d33e3ad5f2e05cc /trm/utils/functions.py
rrm workspace: TRM/HRM/SRM code, Maze dataset, dynamical-analysis pipelineHEADmain
Curated export for clone-and-run Maze training (2x A6000) + diagnostics. trm/hrm pretrain.py carry trajectory-augmentation code (backward-compatible). Heavy artifacts (checkpoints/wandb/npz) gitignored; see PROVENANCE.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'trm/utils/functions.py')
-rw-r--r--trm/utils/functions.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/trm/utils/functions.py b/trm/utils/functions.py
new file mode 100644
index 0000000..b123636
--- /dev/null
+++ b/trm/utils/functions.py
@@ -0,0 +1,19 @@
+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)