Skip to content

Instantly share code, notes, and snippets.

@AmosLewis
Created October 7, 2022 16:40
Show Gist options
  • Save AmosLewis/2ec87c5f27e3bf61f6b4bee0ad23aec6 to your computer and use it in GitHub Desktop.
Save AmosLewis/2ec87c5f27e3bf61f6b4bee0ad23aec6 to your computer and use it in GitHub Desktop.
gpt2tosainferenceBug
➜ SHARK git:(gpt) ✗ python tank/pytorch/gpt2/gpt2.py
Torch Golden Result: tensor([[[ -31.8388, -30.9854, -34.4231, ..., -39.7515, -38.6848,
-32.3074],
[ -99.2055, -98.8202, -104.2251, ..., -112.2020, -109.0224,
-100.2584],
[-115.6919, -116.9150, -119.1486, ..., -124.9616, -123.2126,
-116.6671],
[-123.0994, -123.1445, -128.7349, ..., -130.6248, -130.6557,
-125.1285],
[ -80.2680, -81.8277, -89.0646, ..., -94.5047, -96.1721,
-83.7583]]], grad_fn=<UnsafeViewBackward0>)
/home/chi/src/ubuntu20/shark/SHARK/shark.venv/lib/python3.10/site-packages/torch/jit/_check.py:181: UserWarning: The TorchScript type system doesn't support instance-level annotations on empty non-base types in `__init__`. Instead, either 1) use a type annotation in the class body, or 2) wrap the type in `torch.jit.Attribute`.
warnings.warn("The TorchScript type system doesn't support "
/home/chi/src/ubuntu20/shark/SHARK/shark.venv/lib/python3.10/site-packages/torch/jit/_trace.py:744: UserWarning: The input to trace is already a ScriptModule, tracing it is a no-op. Returning the object as is.
warnings.warn(
Target triple found:x86_64-linux-gnu
Traceback (most recent call last):
File "/home/chi/src/ubuntu20/shark/SHARK/tank/pytorch/gpt2/gpt2.py", line 115, in <module>
shark_module.compile()
File "/home/chi/src/ubuntu20/shark/SHARK/shark/shark_inference.py", line 93, in compile
self.shark_runner = SharkRunner(
File "/home/chi/src/ubuntu20/shark/SHARK/shark/shark_runner.py", line 84, in __init__
) = get_iree_compiled_module(
File "/home/chi/src/ubuntu20/shark/SHARK/shark/iree_utils/compile_utils.py", line 125, in get_iree_compiled_module
flatbuffer_blob = compile_module_to_flatbuffer(
File "/home/chi/src/ubuntu20/shark/SHARK/shark/iree_utils/compile_utils.py", line 88, in compile_module_to_flatbuffer
flatbuffer_blob = ireec.compile_str(
File "/home/chi/src/ubuntu20/shark/SHARK/shark.venv/lib/python3.10/site-packages/iree/compiler/tools/core.py", line 277, in compile_str
result = invoke_immediate(cl, immediate_input=input_bytes)
File "/home/chi/src/ubuntu20/shark/SHARK/shark.venv/lib/python3.10/site-packages/iree/compiler/tools/binaries.py", line 194, in invoke_immediate
process = subprocess.run(command_line, capture_output=True, **run_args)
File "/usr/lib/python3.10/subprocess.py", line 503, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "/usr/lib/python3.10/subprocess.py", line 1152, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/lib/python3.10/subprocess.py", line 1983, in _communicate
input_view = memoryview(self._input)
TypeError: memoryview: a bytes-like object is required, not 'torch_mlir._mlir_libs._mlir.ir.Module'
➜ SHARK git:(gpt) ✗
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment