PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
21.8k stars 5.47k forks source link

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

Open JiaXinLI98 opened 3 days ago

JiaXinLI98 commented 3 days ago

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

deepllz commented 3 days ago

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

deepllz commented 3 days ago

麻烦提交一个issus到PaddleNLP吧

JiaXinLI98 commented 3 days ago

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

2.6

JiaXinLI98 commented 3 days ago

麻烦提交一个issus到PaddleNLP吧

好的

ZHUI commented 1 day ago

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