prompting.validators.penalty
#
Submodules#
Package Contents#
Classes#
Helper class that provides a standard way to create an ABC using |
|
Create a collection of name/value pairs. |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
- class prompting.validators.penalty.BasePenaltyModel(max_penalty)#
Bases:
abc.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
max_penalty (float) –
- abstract calculate_penalties(completions)#
- Parameters:
completions (List[str]) –
- Return type:
torch.FloatTensor
- apply_penalties(responses, task)#
- Parameters:
responses (List[bittensor.Synapse]) –
task (prompting.validators.tasks.Task) –
- Return type:
torch.FloatTensor
- class prompting.validators.penalty.PenaltyModelType(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- task_validation_penalty = 'task_validation_penalty'#
- keyword_match_penalty = 'keyword_match_penalty'#
- sentence_match_penalty = 'sentence_match_penalty'#
- class prompting.validators.penalty.TaskValidationPenaltyModel(max_penalty)#
Bases:
prompting.validators.penalty.penalty.BasePenaltyModel
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
max_penalty (float) –
- calculate_penalties(task, completions)#
- Parameters:
task (prompting.validators.tasks.Task) –
completions (List[str]) –
- Return type:
torch.FloatTensor
- class prompting.validators.penalty.KeywordMatchPenaltyModel#
Bases:
prompting.validators.penalty.penalty.BasePenaltyModel
- check_exploits_keywords(completion, name)#
- calculate_penalties(task, completions)#
- Parameters:
task (prompting.validators.tasks.Task) –
completions (List[str]) –
- Return type:
torch.FloatTensor
- class prompting.validators.penalty.ContentMatchPenaltyModel(max_penalty)#
Bases:
prompting.validators.penalty.penalty.BasePenaltyModel
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
max_penalty (float) –
- calculate_penalties(task, completions)#
- Parameters:
task (prompting.validators.tasks.Task) –
completions (List[str]) –
- Return type:
torch.FloatTensor