refactor: use LIGHT as PDM instead of VDM, ignore actions
This commit is contained in:
parent
1f273f13f3
commit
3d6def871d
|
@ -49,7 +49,7 @@ The default behavior is to write a file called `rev-{GIT_REVISION_HASH}-args{HAS
|
||||||
The script also has an option to print some examples instead of writing to a file, for debugging/dev purposes. Example usage:
|
The script also has an option to print some examples instead of writing to a file, for debugging/dev purposes. Example usage:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./waifu/scripts/build_dataset.py --print 1 --modules 'light_dialogue_vdm:LightDialogueVDM' # or -p 1 and -m ...
|
$ ./waifu/scripts/build_dataset.py --print 1 --modules 'light_dialogue_pdm:LightDialoguePDM' # or -p 1 and -m ...
|
||||||
```
|
```
|
||||||
|
|
||||||
Example output:
|
Example output:
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
import typing as t
|
import typing as t
|
||||||
|
|
||||||
|
from waifu.core.consts import PromptConstants
|
||||||
from waifu.datasets.light_dialogue import LightDialogueDataset
|
from waifu.datasets.light_dialogue import LightDialogueDataset
|
||||||
from waifu.modules import BaseModule
|
from waifu.modules import BaseModule
|
||||||
from waifu.utils.strings import normalize_string, title_case
|
from waifu.utils.strings import normalize_string, title_case
|
||||||
|
|
||||||
|
|
||||||
class LightDialogueVDM(BaseModule):
|
class LightDialoguePDM(BaseModule):
|
||||||
'''Vanilla Dialogue Module based on the LIGHT dialogue dataset.'''
|
'''Persona Dialogue Module based on the LIGHT dataset.'''
|
||||||
|
|
||||||
def generator(self) -> t.Generator[str, None, None]:
|
def generator(self) -> t.Generator[str, None, None]:
|
||||||
for episode in LightDialogueDataset():
|
for episode in LightDialogueDataset():
|
||||||
# TODO(11b): Context and persona don't belong in a vanilla dialogue
|
# TODO(11b): Scenario doesn't belong in a persona dialog module.
|
||||||
# module.
|
|
||||||
context_message = f"Context: {episode.context[0]}\n"
|
context_message = f"Context: {episode.context[0]}\n"
|
||||||
|
|
||||||
persona_message = ""
|
persona_message = ""
|
||||||
for agent in episode.agents:
|
for agent in episode.agents:
|
||||||
persona_message += f"{title_case(agent.name)}'s Description: {agent.persona}\n"
|
persona_message += f"{PromptConstants.pdm_prefix_for(title_case(agent.name))}: {agent.persona}\n"
|
||||||
|
|
||||||
episode_messages: t.List[str] = [context_message, persona_message]
|
episode_messages: t.List[str] = [context_message, persona_message]
|
||||||
turn_count = len(episode.speech)
|
turn_count = len(episode.speech)
|
||||||
|
@ -30,9 +30,13 @@ class LightDialogueVDM(BaseModule):
|
||||||
|
|
||||||
# If there was an action performed in that turn, add it to the
|
# If there was an action performed in that turn, add it to the
|
||||||
# string.
|
# string.
|
||||||
action = episode.action[idx]
|
#
|
||||||
if action is not None:
|
# NOTE(11b): Disabled for now. Adding the action like this
|
||||||
message += f" *{action}*"
|
# generates grammatically incorrect sentences.
|
||||||
|
|
||||||
|
# action = episode.action[idx]
|
||||||
|
# if action is not None:
|
||||||
|
# message += f" *{action}*"
|
||||||
|
|
||||||
# If there was an emote in that turn, add it to the string.
|
# If there was an emote in that turn, add it to the string.
|
||||||
emote = episode.emote[idx]
|
emote = episode.emote[idx]
|
|
@ -11,13 +11,13 @@ import typing as t
|
||||||
|
|
||||||
from waifu.modules import BaseModule
|
from waifu.modules import BaseModule
|
||||||
|
|
||||||
# TODO(11b): Needs manual maintenance ot keep up-to-date. Consider doing some
|
# TODO(11b): Needs manual maintenance to keep up-to-date. Consider doing some
|
||||||
# metaprogramming trickery to build this list out instead.
|
# metaprogramming trickery to build this list out instead.
|
||||||
DEFAULT_MODULE_LIST = [
|
DEFAULT_MODULE_LIST = [
|
||||||
"characterai_pdm:CharacterAiPDM",
|
"characterai_pdm:CharacterAiPDM",
|
||||||
"kajiwoto_pdm:KajiwotoPDM",
|
"kajiwoto_pdm:KajiwotoPDM",
|
||||||
# "kajiwoto_vdm:KajiwotoVDM",
|
# "kajiwoto_vdm:KajiwotoVDM",
|
||||||
"light_dialogue_vdm:LightDialogueVDM",
|
"light_dialogue_pdm:LightDialoguePDM",
|
||||||
]
|
]
|
||||||
DEFAULT_MODULES_STRING = ",".join(DEFAULT_MODULE_LIST)
|
DEFAULT_MODULES_STRING = ",".join(DEFAULT_MODULE_LIST)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue