* use fastchat conversations template * require fastchat (fschat) pip install * handle roles dynamically from conversation * tweak fastchat conversation with a monkeypatch to get individual turns * fix up so it works with multiple conversation styles, and don't strip the turns * fix sharegpt fixture now that we're using a more correct tokenization * use a new prompter and support fastchat conversation type * use sharegpt from prompt strategies now * update docs, add chatml template * add a newline after im_end token * ensure we correctly set system message * update per PR feedback to handle deprecated sharegpt types * don't add duplicate wandb req * make sharegpt fields configurable from yml * llama2 fixes * don't fail fatally when turns are improper
29 lines
981 B
Python
29 lines
981 B
Python
"""Module for Jokes prompts using sharegpt style """
|
|
from axolotl.prompt_tokenizers import ShareGPTPromptTokenizingStrategy
|
|
from axolotl.prompters import ShareGPTPrompterV2
|
|
|
|
|
|
def load(tokenizer, cfg):
|
|
return SimpleJokesShareGPTPromptTokenizingStrategy(
|
|
ShareGPTPrompterV2(),
|
|
tokenizer,
|
|
cfg.train_on_inputs,
|
|
cfg.sequence_len,
|
|
)
|
|
|
|
|
|
class SimpleJokesShareGPTPromptTokenizingStrategy(ShareGPTPromptTokenizingStrategy):
|
|
"""
|
|
Tokenization strategy for asking bot to tell a joke and then explain why its funny
|
|
"""
|
|
|
|
# title, text, explanation
|
|
def get_conversation_thread(self, prompt):
|
|
title = "" if not prompt["title"] else prompt["title"] + " "
|
|
return [
|
|
{"from": "human", "value": "Tell me a joke."},
|
|
{"from": "gpt", "value": title + prompt["text"]},
|
|
{"from": "human", "value": "Why is that joke funny?"},
|
|
{"from": "gpt", "value": prompt["explanation"]},
|
|
]
|