Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confused about the type hint of ManualVerbalizer.__init__ #67

Closed
NLPpupil opened this issue Dec 3, 2021 · 1 comment
Closed

Confused about the type hint of ManualVerbalizer.__init__ #67

NLPpupil opened this issue Dec 3, 2021 · 1 comment

Comments

@NLPpupil
Copy link

NLPpupil commented Dec 3, 2021

The type hint of ManualVerbalizer.init includes:

label_words (:obj:`Union[Sequence[str], Mapping[str, str]]`, optional): The label words that are projected by the labels.

However, I found two cases where the type of label_words is neither Sequence[str] or Mapping[str, str].

In Introduction with an Example,

from openprompt.prompts import ManualVerbalizer
promptVerbalizer = ManualVerbalizer(
    classes = classes,
    label_words = {
        "negative": ["bad"],
        "positive": ["good", "wonderful", "great"],
    },
    tokenizer = tokenizer,
)

In 0_basic.py,

myverbalizer = ManualVerbalizer(tokenizer, num_classes=2, 
                        label_words=[["yes"], ["no"], ["maybe"]])
@ShengdingHu
Copy link
Collaborator

Thank you for pointing out this issue. It has been fixed in commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants