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

ERROR dspy.evaluate.evaluate: Error for example in dev set: #1799

Open
fdzr opened this issue Nov 14, 2024 · 1 comment
Open

ERROR dspy.evaluate.evaluate: Error for example in dev set: #1799

fdzr opened this issue Nov 14, 2024 · 1 comment

Comments

@fdzr
Copy link

fdzr commented Nov 14, 2024

Hi,

I'm getting this error when I use MIPROv2 optimizer:

ERROR dspy.evaluate.evaluate: Error for example in dev set: 'list' object has no attribute 'items'. Set provide_traceback=True to see the stack trace.

I created my training set with the following code:

...

for _, row in new_data.iterrows():
        training_set.append(
            dspy.Example(
                sentence1=row["context_x"],
                sentence2=row["context_y"],
                target_word=row["lemma"],
                answer=1 if row["judgment"] >= 3 else 0,
            ).with_inputs("sentence1", "sentence2", "target_word")
        )

and my module was created the following way:"

class Score(dspy.Signature):
    """Classify sentence pairs using WiC style evaluation,
    where 1 means same meaning and 0 meaning completely different
    considering a common target word in both sentences"""

    sentence1: str = dspy.InputField()
    sentence2: str = dspy.InputField()
    target_word: str = dspy.InputField()
    answer: Union[Literal["1", "0"], Literal[1, 0]] = dspy.OutputField()
    

class Wrapper(dspy.Module):
    def __init__(self):
        super().__init__()

        self.generate_answer = dspy.ChainOfThought(Score)

    def forward(self, sentence1, sentence2, target_word):
        pred = self.generate_answer(
            sentence1=sentence1,
            sentence2=sentence2,
            target_word=target_word,
        )
        return pred

I need help community! Thanks!

@Liu-Eroteme
Copy link

are you using assertions in the module you're optimizing? mipro doesn't like those.

try putting your compile call in a with dspy.context(bypass_suggest=True, bypass_assert=True) block

(haven't tested it yet, thought of it on my way home, but should work actually)

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

2 participants