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

List index error using MIPROv2 #1293

Open
eelang-sc opened this issue Jul 19, 2024 · 1 comment
Open

List index error using MIPROv2 #1293

eelang-sc opened this issue Jul 19, 2024 · 1 comment

Comments

@eelang-sc
Copy link

https://github.com/stanfordnlp/dspy/blob/d8b8909773fc31e72cec093db2f26109590e524e/dspy/propose/grounded_proposer.py#L195C1-L197C55

The init pattern finds the Predict init first (instead of the intended dspy module's init) and that will lead to finding no matches in line 201 and thus a list index error in line 203.

class Predict(Module, Parameter):
    def __init__(self, signature, **config):
        self.stage = random.randbytes(8).hex()
        self.signature = ensure_signature(signature)
        self.config = config
        self.reset()

I solved it for myself temporarily replacing

init_content_match = re.search(init_pattern, self.program_code_string)
init_content = init_content_match.group(0)

with

init_content_match = re.findall(init_pattern, self.program_code_string)
init_content = init_content_match[-1]

but that's just a quick patch/hack.

@eelang-sc eelang-sc changed the title List index error List index error using MIPROv2 Jul 19, 2024
@okhat
Copy link
Collaborator

okhat commented Jul 20, 2024

cc @XenonMolecule @arnavsinghvi11 is this something we fixed recently?

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