FasterTransformer
FasterTransformer copied to clipboard
line 106, in run_vitnv_op vit = torch.classes.VisionTransformerClass(vit_weights.weights, TypeError: '_ClassNamespace' object is not callable
Description
python3.10/site-packages/torch/include/ATen/core/ivalue_inl.h":123, please report a bug to PyTorch. Expected Object but got PyObject
Traceback (most recent call last):
File "/home/infer_vit_op.py", line 92, in run_vitnv_op
vit = torch.classes.VisionTransformer.Class(vit_weights.weights,
RuntimeError: isObject()INTERNAL ASSERT FAILED at "/home/.local/lib/python3.10/site-packages/torch/include/ATen/core/ivalue_inl.h":123, please report a bug to PyTorch. Expected Object but got PyObject
### Reproduced Steps
```shell
python infer_visiontransformer_op.py \ 1 ↵
--model_type=ViT-B_16 \
--img_size 384 \
--batch-size=32 \
--th-path ../../ft/build/lib/libpyt_vit.so \
--quant-mode ft2
classifier: token
hidden_size: 768
patches:
size: !!python/tuple
- 16
- 16
representation_size: null
transformer:
attention_dropout_rate: 0.0
dropout_rate: 0.1
mlp_dim: 3072
num_heads: 12
num_layers: 12
[FT][INFO] img_size: 384, patch_size:16
batch_size:32, chn_num : 3
embed_dim: 768, is_fp16 : 0
head_num :12, head_dim : 64
inter_size:3072, num_layer: 12
[WARNING] gemm_config.in is not found; using default GEMM algo
@byshiue hi, do u know why got this error?
I have no idea. From the bug message, It looks like a bug of PyTorch.
please report a bug to PyTorch. Expected Object but got PyObject
@byshiue Maybe, but seems the calling way torch.classes.VisionTrasnformerClass is not fully correct? Your c++ implementation has a namespace before this class....
Do u know how to correctly calling this c++ pytorch op? (I ddin't change anything of code)
@byshiue I have posted a bug to pytorch. can u please help me try on more decent pytorch to see if it can run on your side?
@byshiue I have posted a bug to pytorch. can u please help me try on more decent pytorch to see if it can run on your side?
We have verified PyTorch 1.09 ~ 1.13 by the pytorch docker images on NGC, like nvcr.io/nvidia/ptyroch:22.07-py3.
@byshiue It's weired, I swithched to pytorch 1.12 seems not problem.
We don't have ideas for such bugs about pytorch.