File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
multipy/runtime/interpreter Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,16 @@ import importlib.abc
125125import linecache
126126from zipfile import ZipFile
127127
128+ class DummyMultiPyModule:
129+ def __getattr__(self, key):
130+ return self
131+
132+ def __call__(self, *args, **kwargs):
133+ return self
134+
128135# Disable Python library registration since it's not compatible with multipy.
129- sys.modules["torch._meta_registrations"] = object
136+ sys.modules["torch._meta_registrations"] = DummyMultiPyModule()
137+ sys.modules["torch._decomp"] = DummyMultiPyModule()
130138
131139class RegisterModuleImporter(importlib.abc.InspectLoader):
132140 def __init__(self, find_module_source):
@@ -160,6 +168,8 @@ class RegisterModuleImporter(importlib.abc.InspectLoader):
160168# print("modules:", sys.modules)
161169
162170import torch # has to be done serially otherwise things will segfault
171+ torch._decomp = DummyMultiPyModule()
172+
163173import multipy.utils
164174try:
165175 import torch.version # for some reason torch doesn't import this and cuda fails?
You can’t perform that action at this time.
0 commit comments