Regex
regex(model, regex_str, sampler=multinomial())
Generate structured text in the language of a regular expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
An instance of |
required | |
regex_str
|
str
|
The regular expression that the output must follow. |
required |
sampler
|
Sampler
|
The sampling algorithm to use to generate token ids from the logits distribution. |
multinomial()
|
Returns:
Type | Description |
---|---|
A `SequenceGeneratorAdapter` instance that generates text constrained by the
|
|
regular expression.
|
|