Cadet Tiny
Cadet-TinyはSODAデータセットでトレーニングされた超小型対話モデルで、エッジデバイス推論向けに設計されており、体積はCosmo-3Bモデルの約2%です。
ダウンロード数 2,691
リリース時間 : 4/7/2023
モデル概要
Cadet-Tinyはt5-small事前トレーニングモデルをファインチューニングした対話モデルで、エッジデバイス(例:ラズベリーパイ)向けの軽量対話タスクに適しています。
モデル特徴
軽量設計
低リソースデバイス向けに最適化されており、2GBメモリのデバイスでも動作可能
対話メモリ
対話履歴の追跡と文脈理解をサポート
調整可能なパラメータ
temperatureなどの調整可能なパラメータを提供し、生成の多様性を制御
モデル能力
対話生成
文脈理解
ロールプレイ対話
使用事例
エッジデバイスアプリケーション
ラズベリーパイチャットボット
リソース制約のあるデバイスに軽量対話アシスタントを展開
2GBメモリデバイスでスムーズに動作可能
教育アプリケーション
プログラミング学習アシスタント
プログラミング概念を理解するのを助ける対話アシスタント
🚀 Cadet-Tinyとは?
Allen AIのCosmo-XLにインスパイアされたCadet-Tinyは、SODAデータセットを使って学習させた 非常に小さな 対話モデルです。Cadet-Tinyは、エッジデバイス(2GB RAMのRaspberry Piのような小型デバイス)での推論を想定しています。
Cadet-Tinyは、Googleのt5-small事前学習モデルをベースに学習させており、その結果、Cosmo-3Bモデルの約2%のサイズになっています。
これは私が初めて作ったSEQ2SEQのNLPモデルです!HuggingFaceでこれを共有できてとても嬉しいです!:)
何か質問や改善点に関するコメントがあれば、tcgoldfarb@gmail.comまでご連絡ください。
📦 インストール
このモデルを使用するには、以下の依存関係をインストールする必要があります。
pip install torch transformers colorful
💻 使用例
基本的な使用法
import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import colorful as cf
cf.use_true_colors()
cf.use_style('monokai')
class CadetTinyAgent:
def __init__(self):
print(cf.bold | cf.purple("Waking up Cadet-Tiny..."))
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
self.tokenizer = AutoTokenizer.from_pretrained("t5-small", model_max_length=512)
self.model = AutoModelForSeq2SeqLM.from_pretrained("ToddGoldfarb/Cadet-Tiny", low_cpu_mem_usage=True).to(self.device)
self.conversation_history = ""
def observe(self, observation):
self.conversation_history = self.conversation_history + observation
# The number 400 below is just a truncation safety net. It leaves room for 112 input tokens.
if len(self.conversation_history) > 400:
self.conversation_history = self.conversation_history[112:]
def set_input(self, situation_narrative="", role_instruction=""):
input_text = "dialogue: "
if situation_narrative != "":
input_text = input_text + situation_narrative
if role_instruction != "":
input_text = input_text + " <SEP> " + role_instruction
input_text = input_text + " <TURN> " + self.conversation_history
# Uncomment the line below to see what is fed to the model.
# print(input_text)
return input_text
def generate(self, situation_narrative, role_instruction, user_response):
user_response = user_response + " <TURN> "
self.observe(user_response)
input_text = self.set_input(situation_narrative, role_instruction)
inputs = self.tokenizer([input_text], return_tensors="pt").to(self.device)
# I encourage you to change the hyperparameters of the model! Start by trying to modify the temperature.
outputs = self.model.generate(inputs["input_ids"], max_new_tokens=512, temperature=0.75, top_p=.95,
do_sample=True)
cadet_response = self.tokenizer.decode(outputs[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
added_turn = cadet_response + " <TURN> "
self.observe(added_turn)
return cadet_response
def reset_history(self):
self.conversation_history = []
def run(self):
def get_valid_input(prompt, default):
while True:
user_input = input(prompt)
if user_input in ["Y", "N", "y", "n"]:
return user_input
if user_input == "":
return default
while True:
continue_chat = ""
# MODIFY THESE STRINGS TO YOUR LIKING :)
situation_narrative = "Imagine you are Cadet-Tiny talking to ???."
role_instruction = "You are Cadet-Tiny, and you are talking to ???."
self.chat(situation_narrative, role_instruction)
continue_chat = get_valid_input(cf.purple("Start a new conversation with new setup? [Y/N]:"), "Y")
if continue_chat in ["N", "n"]:
break
print(cf.blue("CT: See you!"))
def chat(self, situation_narrative, role_instruction):
print(cf.green(
"Cadet-Tiny is running! Input [RESET] to reset the conversation history and [END] to end the conversation."))
while True:
user_input = input("You: ")
if user_input == "[RESET]":
self.reset_history()
print(cf.green("[Conversation history cleared. Chat with Cadet-Tiny!]"))
continue
if user_input == "[END]":
break
response = self.generate(situation_narrative, role_instruction, user_input)
print(cf.blue("CT: " + response))
def main():
print(cf.bold | cf.blue("LOADING MODEL"))
CadetTiny = CadetTinyAgent()
CadetTiny.run()
if __name__ == '__main__':
main()
📚 ドキュメント
Google Colabリンク
こちらがGoogle Colabファイルのリンクです。ここでは、モデルの学習プロセスと、AI2のSODA公開データセットの使用方法を解説しています。 https://colab.research.google.com/drive/1cx3Yujr_jGQkseqzXZW-2L0vEyEjds_s?usp=sharing
📄 ライセンス
このモデルは、OpenRAILライセンスの下で公開されています。
📖 引用と特別な感謝
Hyunwoo Kim氏には、SODAデータセットの最適な使用方法について議論してくれたことに特別な感謝を申し上げます。彼らのSODA、Prosocial-Dialog、またはCOSMOに関する研究を見ていない場合は、是非見てみることをおすすめします!また、SODAに関する論文も読んでみてください。論文は以下に示します。
@article{kim2022soda,
title={SODA: Million-scale Dialogue Distillation with Social Commonsense Contextualization},
author={Hyunwoo Kim and Jack Hessel and Liwei Jiang and Peter West and Ximing Lu and Youngjae Yu and Pei Zhou and Ronan Le Bras and Malihe Alikhani and Gunhee Kim and Maarten Sap and Yejin Choi},
journal={ArXiv},
year={2022},
volume={abs/2212.10465}
}
Dialogpt Medium
MIT
DialoGPTは、多輪対話用の大規模事前学習対話応答生成モデルであり、単輪対話のチューリングテストでは人間と同等の性能を発揮します。
対話システム
D
microsoft
267.59k
368
Dialogpt Small
MIT
DialoGPTは最先端の大規模事前学習マルチターン対話応答生成モデルで、単一ターン対話のチューリングテストにおいて、生成される応答の品質が人間の応答品質に匹敵します。
対話システム
D
microsoft
218.89k
123
Blenderbot 400M Distill
Apache-2.0
このモデルは大規模ニューラルモデルと入念に設計されたトレーニング戦略により、マルチスキル融合のオープンドメイン対話能力を実現しています。
対話システム 英語
B
facebook
203.20k
431
Dialogpt Large
MIT
DialoGPTは、多輪対話に特化した最先端の大規模事前学習対話応答生成モデルで、単輪対話のチューリングテストにおいて生成される応答の質は人間の回答と同等です。
対話システム
D
microsoft
49.90k
276
Blenderbot 3B
Apache-2.0
これは大規模ニューラルネットワークに基づくオープンドメイン対話モデルで、複数の対話スキルを統合して自然な会話が可能です。
対話システム
Transformers 英語

B
facebook
11.92k
150
Blenderbot 90M
Apache-2.0
BlenderBotはオープンドメインチャットボットモデルで、多輪対話と様々な対話スキルの融合に特化しています。
対話システム
Transformers 英語

B
facebook
4,669
3
Cadet Tiny
Openrail
Cadet-TinyはSODAデータセットでトレーニングされた超小型対話モデルで、エッジデバイス推論向けに設計されており、体積はCosmo-3Bモデルの約2%です。
対話システム
Transformers 英語

C
ToddGoldfarb
2,691
6
Blenderbot 1B Distill
Apache-2.0
このモデルは高性能なオープンドメインチャットボットで、質問、回答、知識提示、共感など複数の対話スキルを統合できます。
対話システム
Transformers 英語

B
facebook
2,413
37
Blenderbot Small 90M
Apache-2.0
これは大規模ニューラルネットワークに基づくオープンドメイン対話システムで、マルチターンの自然な対話が可能で、さまざまな対話スキルを統合できます。
対話システム 英語
B
facebook
2,407
49
Unieval Dialog
UniEvalは自然言語生成タスクのための多次元評価フレームワークであり、unieval-dialogは対話応答生成タスク向けの事前学習評価器です。
対話システム
Transformers

U
MingZhong
2,021
4
おすすめAIモデル
Llama 3 Typhoon V1.5x 8b Instruct
タイ語専用に設計された80億パラメータの命令モデルで、GPT-3.5-turboに匹敵する性能を持ち、アプリケーションシナリオ、検索拡張生成、制限付き生成、推論タスクを最適化
大規模言語モデル
Transformers 複数言語対応

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-TinyはSODAデータセットでトレーニングされた超小型対話モデルで、エッジデバイス推論向けに設計されており、体積はCosmo-3Bモデルの約2%です。
対話システム
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
RoBERTaアーキテクチャに基づく中国語抽出型QAモデルで、与えられたテキストから回答を抽出するタスクに適しています。
質問応答システム 中国語
R
uer
2,694
98