diff --git a/README.md b/README.md index 883abf5..a4ac086 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ## Latest News +**Support for Unicode(multilingual) grammars** (2024-02-29) **Integration with Text-Generation-WebUI** (2023-12-17) We are thrilled to announce that `transformers_cfg` has been used in the [Text-Generation-WebUI](https://github.com/oobabooga/text-generation-webui) project. @@ -85,6 +86,7 @@ if __name__ == "__main__": - We support EBNF grammar description format - We offer the same grammar interface as llama-cpp project, allowing you to drop-in replace llama-cpp with transformers-CFG. - We allow you to use any of the models in the πŸ€— Transformers library, including the ones that are not supported by llama-cpp. +- We support multilingual grammars, you can use any character from any language in your grammar, e.g. δΈ­ζ–‡, ζ—₯本θͺž, ν•œκ΅­μ–΄, ΰ€Ήΰ€Ώΰ€¨ΰ₯ΰ€¦ΰ₯€, Ψ§Ω„ΨΉΨ±Ψ¨ΩŠΨ©, Χ’Χ‘Χ¨Χ™Χͺ, or emoji πŸ€—. ## What is grammar ? @@ -116,6 +118,12 @@ You can use it to describe very simple but useful things, like a valid email add phone_number ::= "+" [0-9]+ ``` +You can also force it to [generate only emojis](examples/generate_emoji.py) or [generate only korean characters](examples/generate_korean.py). +``` +['Describe your feeling with emoji: πŸ™ŒπŸ™‚πŸ˜πŸ˜―πŸ˜…πŸ™πŸ™‡πŸ™ˆπŸ™ŠπŸ™‹πŸ™ƒπŸ™†πŸ™…πŸ™„πŸ™πŸ™‚πŸ™€πŸ™‰πŸ™ŽπŸ™ŠπŸ™‹πŸ™ƒπŸ™†πŸ™…πŸ™„πŸ™πŸ™‚πŸ™€πŸ™‰πŸ™ŽπŸ™ŠπŸ™‹πŸ™ƒπŸ™†', 'Write a poem with emoji: πŸ™πŸ˜πŸ™πŸ™πŸ™ŒπŸ™πŸ™πŸ™πŸ™πŸ˜πŸ˜…πŸ™πŸ™πŸ™πŸ™πŸ™πŸ™πŸ™‡πŸ™πŸ™πŸ™πŸ™πŸ™πŸ™πŸ™πŸ™πŸ™πŸ™‹πŸ™πŸ™πŸ™πŸ™πŸ™πŸ™'] +``` + + More details can be found in this [doc from llama-cpp](https://github.com/ggerganov/llama.cpp/tree/master/grammars) Advanced grammar debugging guide can be found [here](docs/debugging_custom_grammars.md)