hf_text-generation-inference/benchmark/src
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
..
app.rs chore: bump rust version and annotate/fix all clippy warnings (#1455) 2024-01-22 15:22:54 +01:00
event.rs feat(benchmark): tui based benchmarking tool (#149) 2023-03-30 15:26:27 +02:00
generation.rs feat: add more latency metrics in forward (#1346) 2023-12-14 15:59:38 +01:00
lib.rs Outlines guided generation (#1539) 2024-02-15 10:28:10 +01:00
main.rs feat(server): add frequency penalty (#1541) 2024-02-08 18:41:25 +01:00
table.rs feat(server): add frequency penalty (#1541) 2024-02-08 18:41:25 +01:00
utils.rs feat(benchmark): tui based benchmarking tool (#149) 2023-03-30 15:26:27 +02:00