EasyNLP icon indicating copy to clipboard operation
EasyNLP copied to clipboard

Failed to run example script for CP-Tuning: type object got multiple values for keyword argument 'user_defined_parameters'

Open huhk-sysu opened this issue 3 years ago • 1 comments

I'm using pai-easynlp 0.0.3 installed by pip.

I copy the training command from here and modify a little.

echo '=========[ Fewshot Training: CP-Tuning on Text Classification ]========='
easynlp \
    --app_name=text_classify \
    --mode=train \
    --worker_count=1 \
    --worker_gpu=1 \
    --tables=data/fewshot_train.tsv,data/fewshot_dev.tsv \
    --input_schema=sid:str:1,sent1:str:1,sent2:str:1,label:str:1 \
    --first_sequence=sent1 \
    --second_sequence=sent2 \
    --label_name=label \
    --label_enumerate_values=0,1 \
    --checkpoint_dir=./fewshot_model/ \
    --learning_rate=1e-5 \
    --epoch_num=1 \
    --random_seed=42 \
    --save_checkpoint_steps=100 \
    --sequence_length=512 \
    --micro_batch_size=8 \
    --user_defined_parameters="
        pretrain_model_name_or_path=/path/to/pretrained/model
        enable_fewshot=True
        type=cpt_fewshot
        pattern=sent1,label,用,sent2,概括。
    "

And here's the error stack. image

huhk-sysu avatar Jul 01 '22 08:07 huhk-sysu

https://github.com/alibaba/EasyNLP/blob/bf17be30b01ec3ebf7a135804b4fb0fff544cb7f/easynlp/fewshot_learning/fewshot_evaluator.py#L131-L145

It's due to the appearance of another argument called user_defined_parameters in kwargs, IMO.

Add a line kwargs.pop('user_defined_parameters') before generating FewshotBaseDataset may fix it.

huhk-sysu avatar Jul 01 '22 09:07 huhk-sysu