chat_prompt_templates
1.0.0
さまざまなチャットLLMの基本的なプロンプトテンプレートのコレクション| Chat LLMの基本プロンプトテンプレートコレクション
動機:基本的なプロンプトテンプレートは、次の指示の有効性に大きく影響します。さまざまなアーキテクチャのモデルは、トレーニング中に異なるプロンプトテンプレートを使用する場合があります。ただし、現在、これらのテンプレートは見つけるのが難しい場合があります。時々、それらはサンプルコードに埋め込まれたり、Githubの問題に隠されたり、公式ブログに見られることもあります...
動機:基本的なプロンプトテンプレートは、次の命令の影響に大きく影響します。さまざまなアーキテクチャのモデルは、トレーニング時に異なるヒントテンプレートを使用する場合があります。ただし、これらのテンプレートは、現時点では見つけるのが難しいことがよくあります。時々、それらはサンプルコードに埋め込まれており、Githubの問題に隠されたり、時には公式のブログにあることもあります...
注記
チャットマークアップ言語は主流です。 Huggingfaceの変圧器、OpenaiのTiktoken。
チャットマークアップ言語は、Huggingfaceのトランス、OpenaiのTiktokenなどの主流形式です。
(アーキテクチャによるアルファベット順)
(スキーマ名の辞書順序でソート)
template = """<reserved_195>{query}<reserved_196>""" template = """<|system|>
You are ChatGLM3, a large language model trained by Zhipu.AI. Follow the user's instructions carefully. Respond using markdown.
<|user|>
{query}
<|assistant|>
""" template = """<bos><start_of_turn>user
{query}<end_of_turn>
<start_of_turn>model""" template = """<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
{query}<|im_end|>
<|im_start|>assistant
""" template = """<s>[INST] <<SYS>>
You are a helpful, respectful and honest assistant.
<</SYS>> {query} [/INST] Sure, I'd be happy to help. Here is the answer:"""Sure, I'd be happy to help. Here is the answer:冗長モデルの出力を回避します。 template = """Instruct: {query} n Output:"""
# or template = """Alice: {query}nBob:""" template = """<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
{query}<|im_end|>
<|im_start|>assistant
"""<|im_end|>または<|endoftext|>のような特別なトークンを出力します。テキストを削除するか、次のようなstopパラメーターを使用できます。 # Using vLLM interface
payload = json . dumps ({
"prompt" : query ,
"n" : 1 ,
"stop" : [ "<|endoftext|>" , "<|im_end|>" ],
}) template = """<|im_start|>system
{system_message}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant""" template = """<|begin_of_text|><|start_header_id|>system<|end_header_id|>
You are a helpful AI assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>
{query}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
""" template =