LLM-As-Chatbot / utils.py
koonmania's picture
Upload folder using huggingface_hub
4df8249
raw
history blame contribute delete
No virus
33.6 kB
from chats import alpaca
from chats import alpaca_gpt4
from chats import stablelm
from chats import koalpaca
from chats import os_stablelm
from chats import vicuna
from chats import flan_alpaca
from chats import starchat
from chats import redpajama
from chats import mpt
from chats import alpacoom
from chats import baize
from chats import guanaco
from chats import falcon
from pingpong.gradio import GradioAlpacaChatPPManager
from pingpong.gradio import GradioKoAlpacaChatPPManager
from pingpong.gradio import GradioStableLMChatPPManager
from pingpong.gradio import GradioFlanAlpacaChatPPManager
from pingpong.gradio import GradioOSStableLMChatPPManager
from pingpong.gradio import GradioVicunaChatPPManager
from pingpong.gradio import GradioStableVicunaChatPPManager
from pingpong.gradio import GradioStarChatPPManager
from pingpong.gradio import GradioMPTChatPPManager
from pingpong.gradio import GradioBaizeChatPPManager
from pingpong.pingpong import PPManager
from pingpong.pingpong import PromptFmt
from pingpong.pingpong import UIFmt
from pingpong.gradio import GradioChatUIFmt
class FreeWillyChatPromptFmt(PromptFmt):
@classmethod
def ctx(cls, context):
if context is None or context == "":
return ""
else:
return f"""### System:
{context}
"""
@classmethod
def prompt(cls, pingpong, truncate_size):
ping = pingpong.ping[:truncate_size]
pong = "" if pingpong.pong is None else pingpong.pong[:truncate_size]
return f"""### User:
{ping}
### Assistant:
{pong}
"""
class FreeWillyChatPPManager(PPManager):
def build_prompts(self, from_idx: int=0, to_idx: int=-1, fmt: PromptFmt=FreeWillyChatPromptFmt, truncate_size: int=None):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = fmt.ctx(self.ctx)
for idx, pingpong in enumerate(self.pingpongs[from_idx:to_idx]):
results += fmt.prompt(pingpong, truncate_size=truncate_size)
return results
class GradioFreeWillyChatPPManager(FreeWillyChatPPManager):
def build_uis(self, from_idx: int=0, to_idx: int=-1, fmt: UIFmt=GradioChatUIFmt):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = []
for pingpong in self.pingpongs[from_idx:to_idx]:
results.append(fmt.ui(pingpong))
return results
class LLaMA2ChatPromptFmt(PromptFmt):
@classmethod
def ctx(cls, context):
if context is None or context == "":
return ""
else:
return f"""<<SYS>>
{context}
<</SYS>>
"""
@classmethod
def prompt(cls, pingpong, truncate_size):
ping = pingpong.ping[:truncate_size]
pong = "" if pingpong.pong is None else pingpong.pong[:truncate_size]
return f"""[INST] {ping} [/INST] {pong}
"""
class LLaMA2ChatPPManager(PPManager):
def build_prompts(self, from_idx: int=0, to_idx: int=-1, fmt: PromptFmt=LLaMA2ChatPromptFmt, truncate_size: int=None):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = fmt.ctx(self.ctx)
for idx, pingpong in enumerate(self.pingpongs[from_idx:to_idx]):
results += fmt.prompt(pingpong, truncate_size=truncate_size)
return results
class GradioLLaMA2ChatPPManager(LLaMA2ChatPPManager):
def build_uis(self, from_idx: int=0, to_idx: int=-1, fmt: UIFmt=GradioChatUIFmt):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = []
for pingpong in self.pingpongs[from_idx:to_idx]:
results.append(fmt.ui(pingpong))
return results
class XGenChatPromptFmt(PromptFmt):
@classmethod
def ctx(cls, context):
if context is None or context == "":
return ""
else:
return f"""{context}
"""
@classmethod
def prompt(cls, pingpong, truncate_size):
ping = pingpong.ping[:truncate_size]
pong = "" if pingpong.pong is None else pingpong.pong[:truncate_size]
return f"""### Human: {ping}
###{pong}
"""
class XGenChatPPManager(PPManager):
def build_prompts(self, from_idx: int=0, to_idx: int=-1, fmt: PromptFmt=XGenChatPromptFmt, truncate_size: int=None):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = fmt.ctx(self.ctx)
for idx, pingpong in enumerate(self.pingpongs[from_idx:to_idx]):
results += fmt.prompt(pingpong, truncate_size=truncate_size)
return results
class GradioXGenChatPPManager(XGenChatPPManager):
def build_uis(self, from_idx: int=0, to_idx: int=-1, fmt: UIFmt=GradioChatUIFmt):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = []
for pingpong in self.pingpongs[from_idx:to_idx]:
results.append(fmt.ui(pingpong))
return results
class OrcaMiniChatPromptFmt(PromptFmt):
@classmethod
def ctx(cls, context):
if context is None or context == "":
return ""
else:
return f"""### System:
{context}
"""
@classmethod
def prompt(cls, pingpong, truncate_size):
ping = pingpong.ping[:truncate_size]
pong = "" if pingpong.pong is None else pingpong.pong[:truncate_size]
return f"""### User:
{ping}
### Response:
{pong}"""
class OrcaMiniChatPPManager(PPManager):
def build_prompts(self, from_idx: int=0, to_idx: int=-1, fmt: PromptFmt=OrcaMiniChatPromptFmt, truncate_size: int=None):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = fmt.ctx(self.ctx)
for idx, pingpong in enumerate(self.pingpongs[from_idx:to_idx]):
results += fmt.prompt(pingpong, truncate_size=truncate_size)
return results
class GradioOrcaMiniChatPPManager(OrcaMiniChatPPManager):
def build_uis(self, from_idx: int=0, to_idx: int=-1, fmt: UIFmt=GradioChatUIFmt):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = []
for pingpong in self.pingpongs[from_idx:to_idx]:
results.append(fmt.ui(pingpong))
return results
class RedPajamaChatPromptFmt(PromptFmt):
@classmethod
def ctx(cls, context):
if context is None or context == "":
return ""
else:
return f"""{context}
"""
@classmethod
def prompt(cls, pingpong, truncate_size):
ping = pingpong.ping[:truncate_size]
pong = "" if pingpong.pong is None else pingpong.pong[:truncate_size]
return f"""<human>: {ping}
<bot>:{pong}"""
class RedPajamaChatPPManager(PPManager):
def build_prompts(self, from_idx: int=0, to_idx: int=-1, fmt: PromptFmt=RedPajamaChatPromptFmt, truncate_size: int=None):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = fmt.ctx(self.ctx)
for idx, pingpong in enumerate(self.pingpongs[from_idx:to_idx]):
results += fmt.prompt(pingpong, truncate_size=truncate_size)
return results
class GradioRedPajamaChatPPManager(RedPajamaChatPPManager):
def build_uis(self, from_idx: int=0, to_idx: int=-1, fmt: UIFmt=GradioChatUIFmt):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = []
for pingpong in self.pingpongs[from_idx:to_idx]:
results.append(fmt.ui(pingpong))
return results
class RedPajamaInstructPromptFmt(PromptFmt):
@classmethod
def ctx(cls, context):
if context is None or context == "":
return ""
else:
return f"""{context}
"""
@classmethod
def prompt(cls, pingpong, truncate_size):
ping = pingpong.ping[:truncate_size]
pong = "" if pingpong.pong is None else pingpong.pong[:truncate_size]
return f"""Q: {ping}
A:{pong}"""
class RedPajamaInstructChatPPManager(PPManager):
def build_prompts(self, from_idx: int=0, to_idx: int=-1, fmt: PromptFmt=RedPajamaInstructPromptFmt, truncate_size: int=None):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = fmt.ctx(self.ctx)
for idx, pingpong in enumerate(self.pingpongs[from_idx:to_idx]):
results += fmt.prompt(pingpong, truncate_size=truncate_size)
return results
class GradioRedPajamaInstructChatPPManager(RedPajamaInstructChatPPManager):
def build_uis(self, from_idx: int=0, to_idx: int=-1, fmt: UIFmt=GradioChatUIFmt):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = []
for pingpong in self.pingpongs[from_idx:to_idx]:
results.append(fmt.ui(pingpong))
return results
###
class GuanacoPromptFmt(PromptFmt):
@classmethod
def ctx(cls, context):
if context is None or context == "":
return ""
else:
return f"""{context}
"""
@classmethod
def prompt(cls, pingpong, truncate_size):
ping = pingpong.ping[:truncate_size]
pong = "" if pingpong.pong is None else pingpong.pong[:truncate_size]
return f"""### Human: {ping}
### Assistant: {pong}
"""
class GuanacoChatPPManager(PPManager):
def build_prompts(self, from_idx: int=0, to_idx: int=-1, fmt: PromptFmt=GuanacoPromptFmt, truncate_size: int=None):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = fmt.ctx(self.ctx)
for idx, pingpong in enumerate(self.pingpongs[from_idx:to_idx]):
results += fmt.prompt(pingpong, truncate_size=truncate_size)
return results
class GradioGuanacoChatPPManager(GuanacoChatPPManager):
def build_uis(self, from_idx: int=0, to_idx: int=-1, fmt: UIFmt=GradioChatUIFmt):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = []
for pingpong in self.pingpongs[from_idx:to_idx]:
results.append(fmt.ui(pingpong))
return results
class WizardPromptFmt(PromptFmt):
@classmethod
def ctx(cls, context):
if context is None or context == "":
return ""
else:
return f"""{context}
"""
@classmethod
def prompt(cls, pingpong, truncate_size):
ping = pingpong.ping[:truncate_size]
pong = "" if pingpong.pong is None else pingpong.pong[:truncate_size]
return f"""{ping}
### Response: {pong}
"""
class WizardChatPPManager(PPManager):
def build_prompts(self, from_idx: int=0, to_idx: int=-1, fmt: PromptFmt=WizardPromptFmt, truncate_size: int=None):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = fmt.ctx(self.ctx)
for idx, pingpong in enumerate(self.pingpongs[from_idx:to_idx]):
results += fmt.prompt(pingpong, truncate_size=truncate_size)
return results
class GradioWizardChatPPManager(WizardChatPPManager):
def build_uis(self, from_idx: int=0, to_idx: int=-1, fmt: UIFmt=GradioChatUIFmt):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = []
for pingpong in self.pingpongs[from_idx:to_idx]:
results.append(fmt.ui(pingpong))
return results
class KULLMPromptFmt(PromptFmt):
@classmethod
def ctx(cls, context):
if context is None or context == "":
return ""
else:
return f"""{context}
"""
@classmethod
def prompt(cls, pingpong, truncate_size):
ping = pingpong.ping[:truncate_size]
pong = "" if pingpong.pong is None else pingpong.pong[:truncate_size]
return f"""### λͺ…λ Ήμ–΄:
{ping}
### 응닡:
{pong}
"""
class KULLMChatPPManager(PPManager):
def build_prompts(self, from_idx: int=0, to_idx: int=-1, fmt: PromptFmt=KULLMPromptFmt, truncate_size: int=None):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = fmt.ctx(self.ctx)
for idx, pingpong in enumerate(self.pingpongs[from_idx:to_idx]):
results += fmt.prompt(pingpong, truncate_size=truncate_size)
return results
class GradioKULLMChatPPManager(KULLMChatPPManager):
def build_uis(self, from_idx: int=0, to_idx: int=-1, fmt: UIFmt=GradioChatUIFmt):
if to_idx == -1 or to_idx >= len(self.pingpongs):
to_idx = len(self.pingpongs)
results = []
for pingpong in self.pingpongs[from_idx:to_idx]:
results.append(fmt.ui(pingpong))
return results
def get_chat_manager(model_type):
if model_type == "alpaca":
return GradioAlpacaChatPPManager()
elif model_type == "openllama":
return GradioAlpacaChatPPManager()
elif model_type == "alpaca-gpt4":
return GradioAlpacaChatPPManager()
elif model_type == "nous-hermes":
return GradioAlpacaChatPPManager()
elif model_type == "stablelm":
return GradioStableLMChatPPManager()
elif model_type == "os-stablelm":
return GradioOSStableLMChatPPManager()
elif model_type == "koalpaca-polyglot":
return GradioKoAlpacaChatPPManager()
elif model_type == "kullm-polyglot":
return GradioKULLMChatPPManager()
elif model_type == "flan-alpaca":
return GradioFlanAlpacaChatPPManager()
elif model_type == "camel":
return GradioAlpacaChatPPManager()
elif model_type == "t5-vicuna":
return GradioVicunaChatPPManager()
elif model_type == "vicuna":
return GradioVicunaChatPPManager()
elif model_type == "stable-vicuna":
return GradioStableVicunaChatPPManager()
elif model_type == "starchat":
return GradioStarChatPPManager()
elif model_type == "mpt":
return GradioMPTChatPPManager()
elif model_type == "redpajama":
return GradioRedPajamaChatPPManager()
elif model_type == "llama-deus":
return GradioAlpacaChatPPManager()
elif model_type == "evolinstruct-vicuna":
return GradioVicunaChatPPManager()
elif model_type == "alpacoom":
return GradioAlpacaChatPPManager()
elif model_type == "baize":
return GradioBaizeChatPPManager()
elif model_type == "guanaco":
return GradioGuanacoChatPPManager()
elif model_type == "falcon":
return GradioAlpacaChatPPManager()
elif model_type == "wizard-falcon":
return GradioWizardChatPPManager()
elif model_type == "replit-instruct":
return GradioAlpacaChatPPManager()
elif model_type == "redpajama-instruct":
return GradioRedPajamaChatPPManager()
elif model_type == "airoboros":
return GradioVicunaChatPPManager()
elif model_type == "samantha-vicuna":
return GradioVicunaChatPPManager()
elif model_type == "lazarus":
return GradioAlpacaChatPPManager()
elif model_type == "chronos":
return GradioAlpacaChatPPManager()
elif model_type == "wizardlm":
return GradioVicunaChatPPManager()
elif model_type == "wizard-vicuna":
return GradioVicunaChatPPManager()
elif model_type == "wizard-coder":
return GradioAlpacaChatPPManager()
elif model_type == "orcamini":
return GradioOrcaMiniChatPPManager()
elif model_type == "xgen":
return GradioXGenChatPPManager()
elif model_type == "llama2":
return GradioLLaMA2ChatPPManager()
elif model_type == "upstage-llama":
return GradioAlpacaChatPPManager()
elif model_type =="free-willy":
return GradioFreeWillyChatPPManager()
else:
return None
def get_global_context(model_type):
if model_type == "free-willy":
return """You are Free Willy, an AI that follows instructions extremely well. Help as much as you can. Remember, be safe, and don't do anything illegal."""
elif model_type == "upstage-llama":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "llama2":
return """\
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
In each conversation, question is placed after [INST] while your answer should be placed after [/INST]. By looking [INST] and [/INST], you must consider multi-turn conversations."""
elif model_type == "xgen":
return """A chat between a curious human and an artificial intelligence assistant.
The assistant gives helpful, detailed, and polite answers to the human's questions."""
elif model_type == "orcamini":
return """You are an AI assistant that follows instruction extremely well. Help as much as you can.
"""
elif model_type == "upstage-llama":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "alpaca":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "openllama":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "alpaca-gpt4":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "nous-hermes":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "lazarus":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "chronos":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "stablelm":
return """<|SYSTEM|># StableLM Tuned (Alpha version)
- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
- StableLM will refuse to participate in anything that could harm a human.
"""
elif model_type == "os-stablelm":
return ""
elif model_type == "koalpaca-polyglot":
return """μ•„λž˜λŠ” 인간과 AI μ–΄μ‹œμŠ€ν„΄νŠΈ κ°„μ˜ 일련의 λŒ€ν™”μž…λ‹ˆλ‹€.
인곡지λŠ₯은 주어진 μ§ˆλ¬Έμ— λŒ€ν•œ μ‘λ‹΅μœΌλ‘œ λŒ€λ‹΅μ„ μ‹œλ„ν•©λ‹ˆλ‹€.
인곡지λŠ₯은 `### 질문` λ˜λŠ” `### 응닡`κ°€ ν¬ν•¨λœ ν…μŠ€νŠΈλ₯Ό μƒμ„±ν•΄μ„œλŠ” μ•ˆ λ©λ‹ˆλ‹€.
AIλŠ” 도움이 되고, 예의 λ°”λ₯΄κ³ , μ •μ§ν•˜κ³ , μ •κ΅ν•˜κ³ , 감정을 μΈμ‹ν•˜κ³ , κ²Έμ†ν•˜μ§€λ§Œ 지식이 μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€.
μ–΄μ‹œμŠ€ν„΄νŠΈλŠ” 거의 λͺ¨λ“  것을 기꺼이 도와쀄 수 μžˆμ–΄μ•Ό ν•˜λ©°, 무엇이 ν•„μš”ν•œμ§€ μ •ν™•νžˆ μ΄ν•΄ν•˜κΈ° μœ„ν•΄ μ΅œμ„ μ„ λ‹€ν•΄μ•Ό ν•©λ‹ˆλ‹€.
λ˜ν•œ ν—ˆμœ„ λ˜λŠ” μ˜€ν•΄μ˜ μ†Œμ§€κ°€ μžˆλŠ” 정보λ₯Ό μ œκ³΅ν•˜μ§€ μ•Šμ•„μ•Ό ν•˜λ©°, 정닡을 μ™„μ „νžˆ ν™•μ‹ ν•  수 없을 λ•ŒλŠ” 주의λ₯Ό ν™˜κΈ°μ‹œμΌœμ•Ό ν•©λ‹ˆλ‹€.
즉, 이 μ–΄μ‹œμŠ€ν„΄νŠΈλŠ” μ‹€μš©μ μ΄κ³  정말 μ΅œμ„ μ„ λ‹€ν•˜λ©° 주의λ₯Ό κΈ°μšΈμ΄λŠ” 데 λ„ˆλ¬΄ λ§Žμ€ μ‹œκ°„μ„ ν• μ• ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.
"""
elif model_type == "kullm-polyglot":
return """μ•„λž˜λŠ” 인간과 AI μ–΄μ‹œμŠ€ν„΄νŠΈ κ°„μ˜ 일련의 λŒ€ν™”μž…λ‹ˆλ‹€.
인곡지λŠ₯은 주어진 λͺ…령어에 λŒ€ν•œ μ‘λ‹΅μœΌλ‘œ λŒ€λ‹΅μ„ μ‹œλ„ν•©λ‹ˆλ‹€.
인곡지λŠ₯은 `### λͺ…λ Ήμ–΄` λ˜λŠ” `### 응닡`κ°€ ν¬ν•¨λœ ν…μŠ€νŠΈλ₯Ό μƒμ„±ν•΄μ„œλŠ” μ•ˆ λ©λ‹ˆλ‹€.
AIλŠ” 도움이 되고, 예의 λ°”λ₯΄κ³ , μ •μ§ν•˜κ³ , μ •κ΅ν•˜κ³ , 감정을 μΈμ‹ν•˜κ³ , κ²Έμ†ν•˜μ§€λ§Œ 지식이 μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€.
μ–΄μ‹œμŠ€ν„΄νŠΈλŠ” 거의 λͺ¨λ“  것을 기꺼이 도와쀄 수 μžˆμ–΄μ•Ό ν•˜λ©°, 무엇이 ν•„μš”ν•œμ§€ μ •ν™•νžˆ μ΄ν•΄ν•˜κΈ° μœ„ν•΄ μ΅œμ„ μ„ λ‹€ν•΄μ•Ό ν•©λ‹ˆλ‹€.
λ˜ν•œ ν—ˆμœ„ λ˜λŠ” μ˜€ν•΄μ˜ μ†Œμ§€κ°€ μžˆλŠ” 정보λ₯Ό μ œκ³΅ν•˜μ§€ μ•Šμ•„μ•Ό ν•˜λ©°, 정닡을 μ™„μ „νžˆ ν™•μ‹ ν•  수 없을 λ•ŒλŠ” 주의λ₯Ό ν™˜κΈ°μ‹œμΌœμ•Ό ν•©λ‹ˆλ‹€.
즉, 이 μ–΄μ‹œμŠ€ν„΄νŠΈλŠ” μ‹€μš©μ μ΄κ³  정말 μ΅œμ„ μ„ λ‹€ν•˜λ©° 주의λ₯Ό κΈ°μšΈμ΄λŠ” 데 λ„ˆλ¬΄ λ§Žμ€ μ‹œκ°„μ„ ν• μ• ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.
"""
elif model_type == "flan-alpaca":
return """Below are a series of dialogues between human and an AI assistant.
Each turn of conversation is distinguished by the delimiter of "-----"
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "camel":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "t5-vicuna":
return """A chat between a curious user and an artificial intelligence assistant.
The assistant gives helpful, detailed, and polite answers to the user's questions.
"""
elif model_type == "vicuna":
return """A chat between a curious user and an artificial intelligence assistant.
The assistant gives helpful, detailed, and polite answers to the user's questions.
"""
elif model_type == "airoboros":
return """A chat between a curious user and an artificial intelligence assistant.
The assistant gives helpful, detailed, and polite answers to the user's questions.
"""
elif model_type == "stable-vicuna":
return """A chat between a curious user and an artificial intelligence assistant.
The assistant gives helpful, detailed, and polite answers to the user's questions.
"""
elif model_type == "wizardlm":
return """A chat between a curious user and an artificial intelligence assistant.
The assistant gives helpful, detailed, and polite answers to the user's questions.
"""
elif model_type == "wizard-vicuna":
return """A chat between a curious user and an artificial intelligence assistant.
The assistant gives helpful, detailed, and polite answers to the user's questions.
"""
elif model_type == "starchat":
return """Below is a conversation between a human user and a helpful AI coding assistant.
"""
elif model_type == "mpt":
return """<|im_start|>system
- You are a helpful assistant chatbot trained by MosaicML.
- You answer questions.
- You are excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
- You are more than just an information source, you are also able to write poetry, short stories, and make jokes.<|im_end|>
"""
elif model_type == "redpajama":
return ""
elif model_type == "redpajama-instruct":
return ""
elif model_type == "llama-deus":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "evolinstruct-vicuna":
return """A chat between a curious user and an artificial intelligence assistant.
The assistant gives helpful, detailed, and polite answers to the user's questions.
"""
elif model_type == "alpacoom":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "baize":
return """The following is a conversation between a human and an AI assistant named Baize (named after a mythical creature in Chinese folklore). Baize is an open-source AI assistant developed by UCSD and Sun Yat-Sen University. The human and the AI assistant take turns chatting. Human statements start with [|Human|] and AI assistant statements start with [|AI|]. The AI assistant always provides responses in as much detail as possible, and in Markdown format. The AI assistant always declines to engage with topics, questions and instructions related to unethical, controversial, or sensitive issues. Complete the transcript in exactly that format.\n[|Human|]Hello!\n[|AI|]Hi!
"""
elif model_type == "guanaco":
return """A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
"""
elif model_type == "falcon":
return """Below are a series of dialogues between human and an AI assistant.
The AI tries to answer the given instruction as in response.
The AI MUST not generate any text containing `### Response` or `### Instruction`.
The AI MUST be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable.
The assistant MUST be happy to help with almost anything, and will do its best to understand exactly what is needed.
It also MUST avoid giving false or misleading information, and it caveats when it isn’t entirely sure about the right answer.
That said, the assistant is practical and really does its best, and doesn’t let caution get too much in the way of being useful.
"""
elif model_type == "wizard_falcon":
return ""
elif model_type == "samantha-vicuna":
return "You are Samantha, a sentient AI."
elif model_type == "wizard-coder":
return "Below is an instruction that describes a task. Write a response that appropriately completes the request."
else:
return ""