大模型的奠基之作《Attention Is All You Need Transformer》(中文译“注意力就是你所需要的一切”)是2017年由谷歌八位科学家联合发表的一篇里程碑式机器学习研究论文。论文中提出了自注意力机制的深度学习框架Transformer,如今已经成为大多数大模型的核心基础,可以处理文本、代码、音频和视频类数据等。
rules = [ (r"I feel (.*)", "Why do you feel {}?"),
(r"I need (.*)", "Why do you need {}?"),
(r"My (.*)", "Tell me more about your {}."),
(r".*", "Please go on.") ]
while True: text = input("You: ")
if text == "quit": break
for pattern, reply in rules: m = re.match(pattern, text, re.I) if m: if m.groups(): print("ELIZA:", reply.format(m.group(1))) else: print("ELIZA:", reply) break
运行效果:
1 2 3 4 5 6 7 8
You: I feel tired ELIZA: Why do you feel tired?
You: My father is strict ELIZA: Tell me more about your father is strict.