novelai_api.BiasGroup

class BiasGroup[source]

Bases: object

__init__(bias: float, ensure_sequence_finish: bool = False, generate_once: bool = False, enabled: bool = True)[source]

Create a bias group

Parameters:
  • bias – Bias value of the bias group. Negative is a downbias, positive is an upbias

  • ensure_sequence_finish – Ensures the bias completes

  • generate_once – Only biases for the first occurrence

  • enabled – Is the bias group enabled

bias: float
ensure_sequence_finish: bool
generate_once: bool
enabled: bool
classmethod from_data(data: Dict[str, Any]) novelai_api.BiasGroup.BiasGroup[source]

Create a bias group from bias group data

add(*sequences: Dict[str, List[List[int]]] | Dict[str, List[int]] | List[int] | str) novelai_api.BiasGroup.BiasGroup[source]

Add elements to the bias group. Elements can be string or tokenized strings Using tokenized strings is not recommended, for flexibility between tokenizers

get_tokenized_entries(model: novelai_api.Preset.Model) Iterable[Dict[str, any]][source]

Return the tokenized sequences for the bias group, if it is enabled

Parameters:

model – Model to use for tokenization