Paddle 动态模型转静态模型时,使用提供的export_model.py时,报ValueError: The decorated function generate requires 4 arguments,but received 26

8ehkhllq  于 5个月前  发布在  其他
关注(0)|答案(5)|浏览(61)

bug描述 Describe the Bug

启动脚本:

动转静命令参考

python ./predict/export_model.py --model_name_or_path meta-llama/Llama-2-7b-chat --inference_model --output_path ./inference --dtype float16 --block_attn

报错回溯:
input_sepc定义在PaddleNLP-develop/paddlenlp/generation/utils.py(1279)
input_spec = [
paddle.static.InputSpec(shape=[None, None], dtype="int64"), # input_ids
paddle.static.InputSpec(shape=[None, None], dtype="int64"), # attention_mask
None, # position_ids
paddle.static.InputSpec(shape=[1], dtype="int64"), # max_length
0, # min_length
"sampling", # decode_strategy
temperature, # temperature
top_k_spec, # top_k
top_p_spec, # top_p
1, # repetition_penalty

num_beams

1,

num_beam_groups

1,

length_penalty

0.0,

early_stopping

False,

bos_token_id

config.get("bos_token_id", 0),

eos_token_id

config.get("eos_token_id", 0),

pad_token_id

config.get("pad_token_id", 0),

decoder_start_token_id

None,

forced_bos_token_id

None,

forced_eos_token_id

None,

no_repeat_ngram_size

None,

num_return_sequences

1,

diversity_rate

0.0,

use_cache

True,

use_fast=False,

False,

use_fp16_decoding=False,

False,
]
generate接收参数为:
def generate(
self,
input_ids: paddle.Tensor = None,
generation_config: GenerationConfig = None,
stopping_criteria: StoppingCriteria = None,
streamer: BaseStreamer = None,
**kwargs,

报错信息:ValueError: The decorated function generate requires 4 arguments: ['input_ids', 'generation_config', 'stopping_criteria', 'streamer'], but received 26 with (InputSpec(shape=(-1, -1), dtype=paddle.int64, name=None, stop_gradient=False), InputSpec(shape=(-1, -1), dtype=paddle.int64, name=None, stop_gradient=False), None, InputSpec(shape=(1,), dtype=paddle.int64, name=None, stop_gradient=False), 0, 'sampling', InputSpec(shape=(1,), dtype=paddle.float32, name=None, stop_gradient=False), 0, InputSpec(shape=(1,), dtype=paddle.float32, name=None, stop_gradient=False), 1, 1, 1, 0.0, False, 0, 0, 0, None, None, None, None, 1, 0.0, True, False, False).

其他补充信息 Additional Supplementary Information

No response

mkh04yzy

mkh04yzy1#

请问什么版本的paddleNLP啊,看起来是input_spec传错了?

ctehm74n

ctehm74n2#

麻烦提交一个issus到PaddleNLP吧

7tofc5zh

7tofc5zh3#

请问什么版本的paddleNLP啊,看起来是input_spec传错了?

2.6

omvjsjqw

omvjsjqw4#

麻烦提交一个issus到PaddleNLP吧

好的

0s0u357o

0s0u357o5#

paddle是什么版本?
paddlenlp是什么版本?

相关问题