Skip to content

Error of running zero-shot on dbpedia dataset #14

@XuandongZhao

Description

@XuandongZhao

I have already installed the latest openprompt package. And the script for KPT is

PYTHONPATH=python3
BASEPATH="./"
DATASET=dbpedia #agnews dbpedia imdb amazon yahoo
TEMPLATEID=0 # 1 2 3
SEED=144 # 145 146 147 148
SHOT=0 # 0 1 10 20
VERBALIZER=kpt #
CALIBRATION="--calibration" # ""
FILTER=tfidf_filter # none
MODEL_NAME_OR_PATH="roberta-large"
RESULTPATH="results_zeroshot"
OPENPROMPTPATH="../OpenPrompt"

cd $BASEPATH

CUDA_VISIBLE_DEVICES=0 $PYTHONPATH zeroshot.py \
--model_name_or_path $MODEL_NAME_OR_PATH \
--result_file $RESULTPATH \
--openprompt_path $OPENPROMPTPATH \
--dataset $DATASET \
--template_id $TEMPLATEID \
--seed $SEED \
--verbalizer $VERBALIZER $CALIBRATION \
--filter $FILTER

And I got the error:

##Num of label words for each label: [217, 256, 214, 211, 324, 294, 215, 766, 345, 408, 880, 181, 246, 666]
Traceback (most recent call last):
  File "/mnt/data2/xuandong/prompt/KPT/zeroshot.py", line 113, in <module>
    support_dataloader = PromptDataLoader(dataset=dataset["support"], template=mytemplate, tokenizer=tokenizer,
  File "/mnt/data2/xuandong/prompt/KPT/openprompt/pipeline_base.py", line 100, in __init__
    self.wrap()
  File "/mnt/data2/xuandong/prompt/KPT/openprompt/pipeline_base.py", line 126, in wrap
    wrapped_example = self.template.wrap_one_example(example)
  File "/mnt/data2/xuandong/prompt/KPT/openprompt/prompt_base.py", line 207, in wrap_one_example
    text = self.incorporate_text_example(example)
  File "/mnt/data2/xuandong/prompt/KPT/openprompt/prompt_base.py", line 107, in incorporate_text_example
    text[i] = d["add_prefix_space"] + d.get("post_processing", lambda x:x)(getattr(example, d['placeholder']))
TypeError: 'str' object is not callable

Could you please check about it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions