Skip to content

Cache Can Break on Version Update #561

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

Closed
lapp0 opened this issue Jan 19, 2024 · 2 comments · Fixed by #566
Closed

Cache Can Break on Version Update #561

lapp0 opened this issue Jan 19, 2024 · 2 comments · Fixed by #566

Comments

@lapp0
Copy link
Contributor

lapp0 commented Jan 19, 2024

Describe the issue as clearly as possible:

#544 doesn't work for me unless I delete the cache introduced in #492

This is because a cached functions signature has changed, resulting in this error:

>       self.states_to_token_maps, self.empty_token_ids = create_states_mapping(
            regex_string, tuple(sorted(tokenizer.vocabulary.items()))
        )
E       ValueError: too many values to unpack (expected 2)

We should either incorporate a version number into the cache or clear the cache upon user upgrade.

Reproduction steps

@lapp0 lapp0 added the bug label Jan 19, 2024
@rlouf
Copy link
Member

rlouf commented Jan 20, 2024

How do libraries usually do this?

@lapp0
Copy link
Contributor Author

lapp0 commented Jan 20, 2024

I can't find much prior art. I recommend we do something like

memory = Cache(cache_dir, eviction_policy="none", cull_limit=0)
if outlines.__version__ != memory.get("__version__"):
    memory.clear()
memory["__version__"] = outlines.__version__

We would then require anyone writing breaking changes to a cached function to increment Outlines patch number.

rlouf pushed a commit that referenced this issue Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants