Skip to content

Commit 0749b88

Browse files
committed
multipy/runtime: mock _decomp
1 parent 2afcb43 commit 0749b88

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

multipy/runtime/interpreter/interpreter_impl.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,16 @@ import importlib.abc
125125
import linecache
126126
from 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
131139
class 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
162170
import torch # has to be done serially otherwise things will segfault
171+
torch._decomp = DummyMultiPyModule()
172+
163173
import multipy.utils
164174
try:
165175
import torch.version # for some reason torch doesn't import this and cuda fails?

0 commit comments

Comments
 (0)