cappr

Completion After Prompt Probability. Make your LLM make a choice

APACHE-2.0 License

Downloads
992
Stars
68
Committers
1

Bot releases are hidden (Show)

cappr - v0.9.4 - don't repeat KV if possible

Published by kddubey about 1 month ago

Breaking changes

None

New features

  • cappr.huggingface.classify doesn't copy data if batch_size=1. Instead, it repeats a view of the data. This change saves memory for tasks where there are many completions. For example, in the Banking 77 demo, peak VRAM usage decreases by ~5 GB.

Bug fixes

None

cappr - v0.9.3 - log-probs is an array when possible Latest Release

Published by kddubey 3 months ago

Breaking changes

None

New features

  • The agg_log_probs function can return a numpy array instead of list if there are a constant number of completions.

Bug fixes

None

cappr - v0.9.2 - arbitrary token log-prob aggregation

Published by kddubey 3 months ago

Breaking changes

None

New features

  • The agg_log_probs function applies func instead of np.exp ∘ func. So if you want average token log-probabilities, set func=np.mean

Bug fixes

None

cappr - v0.9.1 - no setup.py

Published by kddubey 4 months ago

Breaking changes

  • There's no setup.py file, in case you were relying on that.

New features

None

Bug fixes

None

cappr - v0.9.0 - don't require openai, tiktoken

Published by kddubey 9 months ago

Breaking changes

  • pip install cappr will no longer install openai, tiktoken. Install them yourself, or install them using pip install "cappr[openai]". For previous versions of cappr, if you needed to install cappr without these dependencies, you had to run:
python -m pip install \
    "numpy>=1.21.0" \
    "tqdm>=4.27.0" && \
python -m pip install --no-deps cappr

New features

None

Bug fixes

None

cappr - v0.8.8 - default axis for posterior prob

Published by kddubey 11 months ago

Breaking changes

None

New features

Bug fixes

None

cappr - v0.8.7 - Llama CPP no need for logits_all=True

Published by kddubey 11 months ago

Breaking changes

  • None

New features

  • You no longer need to instantiate your Llama CPP model with logits_all=True

Bug fixes

None

cappr - v0.8.6 - support LongLLaMA

Published by kddubey 11 months ago

Breaking changes

  • Setting the internal past attribute of the cache to None now will cause an error to be raised if you try to use it again. Please use the original model instead

New features

  • Support LongLLaMA
  • repr for cached model
  • Don't check logits from Llama CPP

Bug fixes

None

cappr - v0.8.5 - slightly better docstrings

Published by kddubey 11 months ago

Breaking changes

None

New features

  • Slightly better docstrings

Bug fixes

None

cappr - v0.8.4 - cache_model

Published by kddubey 11 months ago

Breaking changes

None

New features

Bug fixes

None

cappr - v0.8.3 - fixes for openai>=1.2, openai<1.0

Published by kddubey 12 months ago

Breaking changes

None

New features

None

Bug fixes

  • Now works for openai>=1.2.0, and backwards compatibility fix for openai<1.0.0
cappr - v0.8.2 - fix for older numpy versions

Published by kddubey 12 months ago

Breaking changes

None

New features

None

Bug fixes

  • For older versions of numpy, _examples functions now work
cappr - v0.8.1 - OpenAI v1.0.0 compatibility

Published by kddubey 12 months ago

Breaking changes

  • end_of_prompt must be a whitespace or empty string. (This was intended since v0.4.7, but I forgot to add a check for it)

New features

  • cappr.openai is now compatible with OpenAI v1.0.0 (and is backwards compatible with previous versions). You can input a client object

Bug fixes

  • cappr.huggingface.classify.token_logprobs now has an option to add a BOS token or not. Previously, it always added it if applicable, which is wrong for the (still highly experimental) discount feature
cappr - v0.8.0 - Llama CPP BPE compatibility

Published by kddubey 12 months ago

Breaking changes

None

New features

  • cappr.llama_cpp.classify now takes an end_of_prompt=" " kwarg, which makes it compatible with models which use BPE tokenizers. (This change is backward compatible with SentencePiece tokenizers because they always separate the prompt and completion with a whitespace.)

Bug fixes

None

cappr - v0.7.0 - no more half measures

Published by kddubey 12 months ago

Breaking changes

  • cappr.huggingface.classify_no_batch and cappr.huggingface.classify_no_cache_no_batch have been deprecated. Instead, set batch_size_completions=1 in cappr.huggingface.classify and cappr.huggingface.classify_no_cache, respectively. Apologies for releasing these half measures

New features

  • cappr.huggingface.classify* can batch over completions to save memory. Set the keyword argument batch_size_completions
  • cappr.huggingface.classify now allows for sub-prompt caching to reduce runtime. Cache shared instructions or exemplars for prompts using the new context manager. See this functionality in action in the Banking 77 demo

Bug fixes

None

cappr - v0.6.6 - loosen prior and token_logprobs inputs

Published by kddubey 12 months ago

Breaking changes

None

New features

  • The prior can now be any sort of sequence, not just a Sequence or numpy array. So you can supply something like the following (from a pandas DataFrame):

    prior = (
        df_tr["correct_completion"]
        .value_counts(normalize=True)
        [completions]
    )
    
  • token_logprobs functions now allow a str input for texts

Bug fixes

None

cappr - v0.6.5 - never modify model, tokenizer input

Published by kddubey 12 months ago

Breaking changes

None

New features

None

Bug fixes

  • Previously, it was possible for an HF or Llama CPP function call to modify the inputted model/tokenizer if an exception were raised. (Technically, the cause is that my context managers didn't wrap the context in a try-finally block. Now they do.)
cappr - v0.6.4 - HF more caching for no-batch module

Published by kddubey 12 months ago

Breaking changes

  • The default batch_size in cappr.huggingface is now 2, not 32
  • The implementation for cappr.huggingface.classify_no_batch is now in cappr.huggingface.classify_no_batch_no_cache

New features

  • cappr.huggingface.classify_no_batch now caches the prompt, which makes it much faster. It can also cache shared instructions or exemplars for prompts using the new context manager. See this functionality in action in the Banking 77 demo

Bug fixes

None

cappr - v0.6.3 - Llama CPP more caching

Published by kddubey 12 months ago

Breaking changes

None

New features

  • For cappr.llama_cpp.classify, cache shared instructions or exemplars for many prompts using the new context manager.

Bug fixes

None

cappr - v0.6.2 - all extras install

Published by kddubey about 1 year ago

Breaking changes

None

New features

  • Install all extra dependencies to run any model format using:

    pip install "cappr[all]"
    

Bug fixes

None

Package Rankings
Top 18.73% on Pypi.org
Badges
Extracted from project README
Python 3.8+ tests codecov PyPI - Package Version License
Related Projects