epfl-dlab / epfl-dlab/transformers-CFG

add support for Chain-of-Thought

Open
#29 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
139
Forks
23
PR merge metrics
No merged PRs in 30d

Description

It would be great if we could support COT like below

```
grammar_str = """
root ::= cot | phone_number

cot ::= [ a-zA-Z0-9]* phone_number

phone_number ::= "+" [0-9]+
"""
```

or for arithemetic

```
root ::= cot | result

cot ::= [^[">>>"] ]* result # We exclude ">>>" from chain of thought to make it a special marker

result ::= ">>>" [0-9]+
```

This way, we could have a prompt like

`Follow this example 3+3*4=3+12=15 >>>15; 97*(12-4)+9=`

and expect a generation like `97*8+9=776+9=785 >>> 785`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.