gimlet-api 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
|
|
1
|
+
gml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
gml/compile.py,sha256=VzNVLojb8D8lISLYxazR3-YkJ6HzscP0juP7yWAltfg,869
|
3
|
+
gimlet_api-0.0.1.dist-info/METADATA,sha256=F7JACoU323q1pnbZD-KQfdJTpd_yKFBS8sXhSHhx-M4,106
|
4
|
+
gimlet_api-0.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
5
|
+
gimlet_api-0.0.1.dist-info/top_level.txt,sha256=wSbIUt3C0p7m2JMxpjK6M83pB9pqGe274eF3qgIxzS8,4
|
6
|
+
gimlet_api-0.0.1.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
gml
|
gml/__init__.py
ADDED
File without changes
|
gml/compile.py
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
from torch.fx.experimental.proxy_tensor import make_fx
|
2
|
+
|
3
|
+
#from torch_mlir.torchscript import compile as torch_mlir_compile
|
4
|
+
from torch_mlir import compile as torch_mlir_compile
|
5
|
+
from torch_mlir import OutputType
|
6
|
+
from torch_mlir.dynamo import _get_decomposition_table
|
7
|
+
|
8
|
+
|
9
|
+
def to_torch_mlir(model, example_inputs):
|
10
|
+
# Running the model a few times on the inputs, leads to more consistent compiled results.
|
11
|
+
# TODO(james): would be good to understand why this is the case.
|
12
|
+
for _ in range(2):
|
13
|
+
_ = model(*example_inputs)
|
14
|
+
|
15
|
+
model = make_fx(model, pre_dispatch=True, decomposition_table=_get_decomposition_table())(*example_inputs)
|
16
|
+
|
17
|
+
compiled = torch_mlir_compile(
|
18
|
+
model,
|
19
|
+
example_inputs,
|
20
|
+
use_tracing=False,
|
21
|
+
ignore_traced_shapes=False,
|
22
|
+
output_type=OutputType.RAW,
|
23
|
+
use_make_fx=False,
|
24
|
+
)
|
25
|
+
|
26
|
+
return compiled
|