hf_text-generation-inference/server/text_generation_server
drbh cef0553d59
Outlines guided generation (#1539)
This WIP PR starts to add grammar support via outlines, currently this
PR supports very simple regex grammars and does not optimize for
precompiling or caching grammar fsm's.

todo:
- [X] add simple outlines guidance to `NextTokenChooser`
- [X] update protos for grammar
- [X] update generation params API
- [X] constrain simple grammar
- [ ] support parsing more complex grammar into fsm
- [ ] support all outline support grammar types
- [ ] explore optimizations to avoid recompiling grammars

guided request
```bash
curl -s 'http://localhost:3000/generate' \
--header 'Content-Type: application/json' \
--data-raw '{
    "inputs": "make an email for david: \n",
    "parameters": {
        "max_new_tokens": 6,
        "grammar": "[\\w-]+@([\\w-]+\\.)+[\\w-]+"
    }
}' | jq
```
response
```json
{
  "generated_text": "david@example.com"
}
```

unguided request
```bash
curl -s 'http://localhost:3000/generate' \
--header 'Content-Type: application/json' \
--data '{
    "inputs": "make an email for david: \n",
    "parameters": {
        "max_new_tokens": 6
    }
}' | jq
```
response
```json
{
  "generated_text": "    email = 'david"
}
```
2024-02-15 10:28:10 +01:00
..
models Outlines guided generation (#1539) 2024-02-15 10:28:10 +01:00
pb feat(server): clear cache on error (#143) 2023-03-28 11:29:35 +02:00
utils Outlines guided generation (#1539) 2024-02-15 10:28:10 +01:00
__init__.py feat(clients): Python client (#103) 2023-03-07 18:52:22 +01:00
cache.py fix(server): decrease memory fragmentation (#557) 2023-07-06 14:28:33 +02:00
cli.py v1.4.0 (#1494) 2024-01-26 19:04:57 +01:00
interceptor.py feat(server): empty cache on errors 2023-07-12 17:06:19 +02:00
server.py fix: fix gpt-q with groupsize = -1 (#1358) 2023-12-18 16:07:05 +01:00
tracing.py feat(clients): Python client (#103) 2023-03-07 18:52:22 +01:00