You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Thrsu (via GitHub)" <gi...@apache.org> on 2023/09/12 07:23:46 UTC

[GitHub] [tvm] Thrsu opened a new issue, #15729: [Bug][Unity] TVMError when using relax to load model with Trilu operator

Thrsu opened a new issue, #15729:
URL: https://github.com/apache/tvm/issues/15729

   The error message suggests that there is an issue with converting the second argument for the trill operation. The error message is as follows: `TVMError: In function relax.op.tril(0: RelayExpr, 1: int) -> RelayExpr: error while converting argument 1: [06:33:20] /workplace/software/tvm/tvm/include/tvm/runtime/packed_func.h:562: InternalError: Check failed: type_code_ == kDLInt (8 vs. 0) : expected int but got Object`
   
   It is worth noting that when running the model using the relay module, no error occurs. The error only occurs when attempting to load the model using the relax module.
   
   The model structure is as below:
   <img width="611" alt="Trilu" src="https://github.com/apache/tvm/assets/89128704/04012b47-ab0e-40bd-ba7e-326eab1afa7c">
   
   ### Actual behavior
   ```
   Traceback (most recent call last):
     File "test.py", line 8, in <module>
       tvm_model = from_onnx(model, opset=18, keep_params_in_input=True)
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 2287, in from_onnx
       return g.from_onnx(graph, opset)
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 1932, in from_onnx
       self._construct_nodes(graph)
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 2095, in _construct_nodes
       op = self._convert_operator(op_name, inputs, attr, self.opset)
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 2191, in _convert_operator
       sym = op_function(self.bb, inputs, attrs, [self._nodes, self._params])
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 621, in _impl_v14
       return relax.op.tril(x, k)
     File "/workplace/software/tvm/tvm/python/tvm/relax/op/create.py", line 238, in tril
       return _ffi_api.tril(x, k)  # type: ignore
     File "/workplace/software/tvm/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 238, in __call__
       raise get_last_ffi_error()
   tvm._ffi.base.TVMError: Traceback (most recent call last):
     4: TVMFuncCall
     3: _ZN3tvm7runtime13Pac
     2: tvm::runtime::TypedPackedFunc<tvm::RelayExpr (tvm::RelayExpr, int)>::AssignTypedLambda<tvm::RelayExpr (*)(tvm::RelayExpr, int)>(tvm::RelayExpr (*)(tvm::RelayExpr, int), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}::operator()(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*) const
     1: tvm::runtime::TVMMovableArgValueWithContext_::operator int<int>() const
     0: _ZN3tvm7runtime6detail
     5: TVMFuncCall
     4: _ZN3tvm7runtime13Pac
     3: tvm::runtime::TypedPackedFunc<tvm::RelayExpr (tvm::RelayExpr, int)>::AssignTypedLambda<tvm::RelayExpr (*)(tvm::RelayExpr, int)>(tvm::RelayExpr (*)(tvm::RelayExpr, int), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}::operator()(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*) const
     2: tvm::runtime::TVMMovableArgValueWithContext_::operator int<int>() const
     1: tvm::runtime::TVMPODValue_::operator int() const
     0: _ZN3tvm7runtime6detail
     File "/workplace/software/tvm/tvm/include/tvm/runtime/packed_func.h", line 777
   TVMError: In function relax.op.tril(0: RelayExpr, 1: int) -> RelayExpr: error while converting argument 1: [06:33:20] /workplace/software/tvm/tvm/include/tvm/runtime/packed_func.h:562: InternalError: Check failed: type_code_ == kDLInt (8 vs. 0) : expected int but got Object
   ```
   ### Environment
   
   - branch: unity
   - tvm: v0.14.dev0-595-gfa0d35b
   - onnx: 1.14.0
   
   ### Steps to reproduce
   
   1. Download the [ONNX model](https://github.com/Thrsu/onnx_model/blob/main/Trilu.onnx)
   2. Run the script below
   ```python
   import onnx
   import tvm
   from tvm import relax
   from tvm.relax.frontend.onnx import from_onnx
   
   onnx_model_path = "Trilu.onnx"
   model = onnx.load(onnx_model_path)
   tvm_model = from_onnx(model, opset=18, keep_params_in_input=True)
   ```
   
   ### Triage
   * needs-triage
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Unity] TVMError when using relax to load model with Trilu operator [tvm]

Posted by "Thrsu (via GitHub)" <gi...@apache.org>.
Thrsu closed issue #15729: [Bug][Unity] TVMError when using relax to load model with Trilu operator
URL: https://github.com/apache/tvm/issues/15729


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Unity] TVMError when using relax to load model with Trilu operator [tvm]

Posted by "jikechao (via GitHub)" <gi...@apache.org>.
jikechao commented on issue #15729:
URL: https://github.com/apache/tvm/issues/15729#issuecomment-1865393531

   @Thrsu This bug has been fixed in #15924, please recheck it and close the issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org