Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.02 KB

README.md

File metadata and controls

43 lines (33 loc) · 1.02 KB

SimpleChatbot

Building a simple chatbot in jupyter using ipywidgets

pip install ipywidgets translate
  1. load generator:
from ppllama import load_model,setup_model_parallel
local_rank, world_size = setup_model_parallel()
model, generator = load_model(ckpt_dir="ckpt/7B/", tokenizer_path="ckpt/tokenizer.model", local_rank=0, world_size=1)
  1. load chatbot
from examples.chatbot.ui import SimpleChatbot
bot =  SimpleChatbot(usrname="User",
                    botname="Chatbot",
                    lang="zh",
                    max_gen_len=64,
                    temperature=0.8,
                    top_p=0.95,
                    prompt=None)
bot.set_generator(generator)
bot.show()
# bot.clear()  # clear chat history
  1. use baidu translator (optional):
APPID= YOUR_APPID
APPKEY= YOUR_APPKEY
bot.switch_baidu_fanyi(appid=APPID, appkey=APPKEY)
bot.show()