Repository navigation
Closed
Labels
triagedIssue has been triaged by maintainers
Description
I just add a no_repeat_ngram_size=4, parameter in run.py
output_gen_ids = decoder.decode(input_ids,
input_lengths,
sampling_config,
no_repeat_ngram_size=4, #Add this line
streaming=streaming)
I got this error.
RuntimeError: forward() Expected a value of type 'Optional[Tensor]' for argument '_12' but instead found type 'int'.
Position: 12
Value: 4
Declaration: forward(__torch__.torch.classes.FasterTransformer.DynamicDecodeOp _0, Tensor _1, int _2, int _3, int _4, int _5, Tensor _6, Tensor? _7, Tensor? _8, Tensor? _9, Tensor? _10, Tensor? _11, Tensor? _12, Tensor? _13, Tensor _14, Tensor _15, Tensor? _16, Tensor? _17, Tensor? _18, Tensor? _19, Tensor? _20, Tensor? _21, Tensor? _22, Tensor? _23, Tensor? _24, Tensor? _25, Tensor? _26, Tensor? _27, Tensor? _28, Tensor? _29, bool _30) -> Tensor _0
Cast error details: Unable to cast 4 to Tensor
ret = func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 1887, in decode
return self.decode_regular(
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 1659, in decode_regular
should_stop, next_step_buffer, tasks, context_lengths, host_context_lengths, attention_mask, logits = self.handle_per_step(
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 1584, in handle_per_step
should_stop = self.dynamic_decoder.forward(
RuntimeError: forward() Expected a value of type 'Optional[Tensor]' for argument '_12' but instead found type 'int'.
Position: 12
Value: 4
Declaration: forward(__torch__.torch.classes.FasterTransformer.DynamicDecodeOp _0, Tensor _1, int _2, int _3, int _4, int _5, Tensor _6, Tensor? _7, Tensor? _8, Tensor? _9, Tensor? _10, Tensor? _11, Tensor? _12, Tensor? _13, Tensor _14, Tensor _15, Tensor? _16, Tensor? _17, Tensor? _18, Tensor? _19, Tensor? _20, Tensor? _21, Tensor? _22, Tensor? _23, Tensor? _24, Tensor? _25, Tensor? _26, Tensor? _27, Tensor? _28, Tensor? _29, bool _30) -> Tensor _0
Cast error details: Unable to cast 4 to Tensor
When I change no_repeat_ngram_size into torch tensor int32. I also got new error.
Running the float16 engine ...
tensor(4, device='cuda:1', dtype=torch.int32)
tensor(4, device='cuda:0', dtype=torch.int32)
Traceback (most recent call last):
File "/code/tensorrt_llm/examples/llama/run.py", line 273, in <module>
generate(**vars(args))
File "/code/tensorrt_llm/examples/llama/run.py", line 251, in generate
output_gen_ids = decoder.decode(input_ids,
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 514, in wrapper
Traceback (most recent call last):
File "/code/tensorrt_llm/examples/llama/run.py", line 273, in <module>
ret = func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 1887, in decode
generate(**vars(args))
File "/code/tensorrt_llm/examples/llama/run.py", line 251, in generate
output_gen_ids = decoder.decode(input_ids,
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 514, in wrapper
return self.decode_regular(
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 1659, in decode_regular
ret = func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 1887, in decode
should_stop, next_step_buffer, tasks, context_lengths, host_context_lengths, attention_mask, logits = self.handle_per_step(
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 1584, in handle_per_step
return self.decode_regular(
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 1659, in decode_regular
should_stop = self.dynamic_decoder.forward(
RuntimeError: [TensorRT-LLM][ERROR] Assertion failed: offset (0) is larger than buffer size (0) (/src/tensorrt_llm/cpp/tensorrt_llm/common/tensor.h:305)
1 0x7fb4ede6ca7c tensorrt_llm::common::throwRuntimeError(char const*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 100
2 0x7fb4edf0e170 int const* tensorrt_llm::common::Tensor::getPtrWithOffset<int const>(unsigned long) const + 576
3 0x7fb4edf118c5 tensorrt_llm::layers::DynamicDecodeLayer<float>::forward(tensorrt_llm::layers::DynamicDecodeLayer<float>::OutputParams&, tensorrt_llm::layers::DynamicDecodeLayer<float>::ForwardParams const&) + 4725
4 0x7fb4edea37b4 torch_ext::FtDynamicDecode<float>::forward(at::Tensor&, int, int, unsigned long, int, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, at::Tensor&, at::Tensor&, at::Tensor&, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, bool) + 2196
5 0x7fb4ede7e642 torch_ext::DynamicDecodeOp::forward(at::Tensor, long, long, long, long, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, at::Tensor, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, bool) + 2418
6 0x7fb4ede9ed99 /usr/local/lib/python3.10/dist-packages/tensorrt_llm/libs/libth_common.so(+0x90d99) [0x7fb4ede9ed99]
7 0x7fb4ede9fa73 std::_Function_handler<void (std::vector<c10::IValue, std::allocator<c10::IValue> >&), torch::class_<torch_ext::DynamicDecodeOp>::defineMethod<torch::detail::WrapMethod<at::Tensor (torch_ext::DynamicDecodeOp::*)(at::Tensor, long, long, long, long, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, at::Tensor, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, bool)> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, torch::detail::WrapMethod<at::Tensor (torch_ext::DynamicDecodeOp::*)(at::Tensor, long, long, long, long, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, at::Tensor, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, bool)>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::initializer_list<torch::arg>)::{lambda(std::vector<c10::IValue, std::allocator<c10::IValue> >&)#1}>::_M_invoke(std::_Any_data const&, std::vector<c10::IValue, std::allocator<c10::IValue> >&) + 51
8 0x7fb5d620cb89 /usr/local/lib/python3.10/dist-packages/torch/lib/libtorch_python.so(+0x8c0b89) [0x7fb5d620cb89]
9 0x7fb5d62dfa9c /usr/local/lib/python3.10/dist-packages/torch/lib/libtorch_python.so(+0x993a9c) [0x7fb5d62dfa9c]
10 0x7fb5d62a3456 /usr/local/lib/python3.10/dist-packages/torch/lib/libtorch_python.so(+0x957456) [0x7fb5d62a3456]
11 0x7fb5d5cf6b0b /usr/local/lib/python3.10/dist-packages/torch/lib/libtorch_python.so(+0x3aab0b) [0x7fb5d5cf6b0b]
12 0x55c4afb52e0e python3(+0x15fe0e) [0x55c4afb52e0e]
13 0x55c4afb495eb _PyObject_MakeTpCall + 603
14 0x55c4afb61910 python3(+0x16e910) [0x55c4afb61910]
15 0x55c4afc7720b python3(+0x28420b) [0x55c4afc7720b]
16 0x55c4afb495eb _PyObject_MakeTpCall + 603
17 0x55c4afb41c66 _PyEval_EvalFrameDefault + 25878
18 0x55c4afb5370c _PyFunction_Vectorcall + 124
19 0x55c4afb3bf52 _PyEval_EvalFrameDefault + 2050
20 0x55c4afb5370c _PyFunction_Vectorcall + 124
21 0x55c4afb3bf52 _PyEval_EvalFrameDefault + 2050
22 0x55c4afb5370c _PyFunction_Vectorcall + 124
23 0x55c4afb62192 PyObject_Call + 290
24 0x55c4afb3e2c1 _PyEval_EvalFrameDefault + 11121
25 0x55c4afb614e1 python3(+0x16e4e1) [0x55c4afb614e1]
26 0x55c4afb3d0d1 _PyEval_EvalFrameDefault + 6529
27 0x55c4afb5370c _PyFunction_Vectorcall + 124
28 0x55c4afb62192 PyObject_Call + 290
29 0x55c4afb3e2c1 _PyEval_EvalFrameDefault + 11121
30 0x55c4afc2ce56 python3(+0x239e56) [0x55c4afc2ce56]
31 0x55c4afc2ccf6 PyEval_EvalCode + 134
32 0x55c4afc577d8 python3(+0x2647d8) [0x55c4afc577d8]
33 0x55c4afc510bb python3(+0x25e0bb) [0x55c4afc510bb]
34 0x55c4afc57525 python3(+0x264525) [0x55c4afc57525]
35 0x55c4afc56a08 _PyRun_SimpleFileObject + 424
36 0x55c4afc56653 _PyRun_AnyFileObject + 67
37 0x55c4afc4941e Py_RunMain + 702
38 0x55c4afc1fcad Py_BytesMain + 45
39 0x7fb73c629d90 /usr/lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7fb73c629d90]
40 0x7fb73c629e40 __libc_start_main + 128
41 0x55c4afc1fba5 _start + 37
should_stop, next_step_buffer, tasks, context_lengths, host_context_lengths, attention_mask, logits = self.handle_per_step(
File "/usr/local/lib/python3.10/dist-packages/tensorrt_llm/runtime/generation.py", line 1584, in handle_per_step
should_stop = self.dynamic_decoder.forward(
RuntimeError: [TensorRT-LLM][ERROR] Assertion failed: offset (0) is larger than buffer size (0) (/src/tensorrt_llm/cpp/tensorrt_llm/common/tensor.h:305)
1 0x7f93759eca7c tensorrt_llm::common::throwRuntimeError(char const*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 100
2 0x7f9375a8e170 int const* tensorrt_llm::common::Tensor::getPtrWithOffset<int const>(unsigned long) const + 576
3 0x7f9375a918c5 tensorrt_llm::layers::DynamicDecodeLayer<float>::forward(tensorrt_llm::layers::DynamicDecodeLayer<float>::OutputParams&, tensorrt_llm::layers::DynamicDecodeLayer<float>::ForwardParams const&) + 4725
4 0x7f9375a237b4 torch_ext::FtDynamicDecode<float>::forward(at::Tensor&, int, int, unsigned long, int, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, at::Tensor&, at::Tensor&, at::Tensor&, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, bool) + 2196
5 0x7f93759fe642 torch_ext::DynamicDecodeOp::forward(at::Tensor, long, long, long, long, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, at::Tensor, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, bool) + 2418
6 0x7f9375a1ed99 /usr/local/lib/python3.10/dist-packages/tensorrt_llm/libs/libth_common.so(+0x90d99) [0x7f9375a1ed99]
7 0x7f9375a1fa73 std::_Function_handler<void (std::vector<c10::IValue, std::allocator<c10::IValue> >&), torch::class_<torch_ext::DynamicDecodeOp>::defineMethod<torch::detail::WrapMethod<at::Tensor (torch_ext::DynamicDecodeOp::*)(at::Tensor, long, long, long, long, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, at::Tensor, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, bool)> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, torch::detail::WrapMethod<at::Tensor (torch_ext::DynamicDecodeOp::*)(at::Tensor, long, long, long, long, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, at::Tensor, at::Tensor, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, c10::optional<at::Tensor>, bool)>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::initializer_list<torch::arg>)::{lambda(std::vector<c10::IValue, std::allocator<c10::IValue> >&)#1}>::_M_invoke(std::_Any_data const&, std::vector<c10::IValue, std::allocator<c10::IValue> >&) + 51
8 0x7f944880cb89 /usr/local/lib/python3.10/dist-packages/torch/lib/libtorch_python.so(+0x8c0b89) [0x7f944880cb89]
9 0x7f94488dfa9c /usr/local/lib/python3.10/dist-packages/torch/lib/libtorch_python.so(+0x993a9c) [0x7f94488dfa9c]
10 0x7f94488a3456 /usr/local/lib/python3.10/dist-packages/torch/lib/libtorch_python.so(+0x957456) [0x7f94488a3456]
11 0x7f94482f6b0b /usr/local/lib/python3.10/dist-packages/torch/lib/libtorch_python.so(+0x3aab0b) [0x7f94482f6b0b]
12 0x556992b3de0e python3(+0x15fe0e) [0x556992b3de0e]
13 0x556992b345eb _PyObject_MakeTpCall + 603
14 0x556992b4c910 python3(+0x16e910) [0x556992b4c910]
15 0x556992c6220b python3(+0x28420b) [0x556992c6220b]
16 0x556992b345eb _PyObject_MakeTpCall + 603
17 0x556992b2cc66 _PyEval_EvalFrameDefault + 25878
18 0x556992b3e70c _PyFunction_Vectorcall + 124
19 0x556992b26f52 _PyEval_EvalFrameDefault + 2050
20 0x556992b3e70c _PyFunction_Vectorcall + 124
21 0x556992b26f52 _PyEval_EvalFrameDefault + 2050
22 0x556992b3e70c _PyFunction_Vectorcall + 124
23 0x556992b4d192 PyObject_Call + 290
24 0x556992b292c1 _PyEval_EvalFrameDefault + 11121
25 0x556992b4c4e1 python3(+0x16e4e1) [0x556992b4c4e1]
26 0x556992b280d1 _PyEval_EvalFrameDefault + 6529
27 0x556992b3e70c _PyFunction_Vectorcall + 124
28 0x556992b4d192 PyObject_Call + 290
29 0x556992b292c1 _PyEval_EvalFrameDefault + 11121
30 0x556992c17e56 python3(+0x239e56) [0x556992c17e56]
31 0x556992c17cf6 PyEval_EvalCode + 134
32 0x556992c427d8 python3(+0x2647d8) [0x556992c427d8]
33 0x556992c3c0bb python3(+0x25e0bb) [0x556992c3c0bb]
34 0x556992c42525 python3(+0x264525) [0x556992c42525]
35 0x556992c41a08 _PyRun_SimpleFileObject + 424
36 0x556992c41653 _PyRun_AnyFileObject + 67
37 0x556992c3441e Py_RunMain + 702
38 0x556992c0acad Py_BytesMain + 45
39 0x7f95aec71d90 /usr/lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f95aec71d90]
40 0x7f95aec71e40 __libc_start_main + 128
41 0x556992c0aba5 _start + 37
--------------------------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
--------------------------------------------------------------------------
--------------------------------------------------------------------------
mpirun detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:
Process name: [[45661,1],0]
Exit code: 1
Activity
byshiue commentedon Nov 21, 2023
The error message has explained the reason. You should pass a
tensorinstead ofint. Please try replaceno_repeat_ngram_size=4byno_repeat_ngram_size=torch.Tensor([4]).to(torch.int32).cuda().symphonylyh commentedon Nov 21, 2023
@matichon-vultureprime you may think why we don't ease the use of this parameter. It's because TRT-LLM allows one more flexibility than HuggingFace -- for batched input, you can actually specify a [batch_size] tensor that can apply different
no_repeat_ngram_sizeto each input in the batch.Although we can still improve this API by letting users give
intandList[int]and handle torch tensor conversion automatically, please follow @byshiue 's usage for now.kmati-dev commentedon Nov 21, 2023
Thank sir. Closed this issue.