摘要: prefix_tuning.py ```python import torch from transformers import PretrainedConfig class PrefixEncoder(torch.nn.Module): r''' The torch.nn model to enc 阅读全文
posted @ 2023-08-09 15:09 鸽鸽的书房 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 今天我们阅读peft源码,主要是为了弄清楚prefix tuning的工作原理和代码细节。 # 理解和思考 (1) prefix tuning和zero-shot的区别在于,把指令/要求(比如要生成positive的句子)和输入的文字直接区分开,指令用连续向量而不是离散词元表示。如果不是prefix 阅读全文
posted @ 2023-08-07 22:21 鸽鸽的书房 阅读(1058) 评论(0) 推荐(0) 编辑
摘要: 记录运行这个代码的过程:https://huggingface.co/docs/peft/task_guides/seq2seq-prefix-tuning # 环境配置 虚拟环境 ```bash python -V conda create -n peft-practice python=3.10 阅读全文
posted @ 2023-08-07 16:31 鸽鸽的书房 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 今天的任务很艰巨,需要把下面这张图的模型架构复现一遍,要有耐心哦。我参考了哈佛NLP小组对transformer的分拆讲解[The Annotated Transformer](http://nlp.seas.harvard.edu/annotated-transformer/),但思路不同于原文。 阅读全文
posted @ 2023-08-01 20:02 鸽鸽的书房 阅读(22) 评论(0) 推荐(0) 编辑
摘要: Transformer鼎鼎大名人尽皆知,2017年就问津于世,鸽鸽2023年才学习它,任何时候圆梦都不算晚!本文记录了我像建房子一样从头到尾打造变形金刚的全过程,目的是熟悉pytorch和深入理解transformer。 先看下我设定的任务难度,我们要解决的是经典的seq2seq翻译任务。使用的数据 阅读全文
posted @ 2023-08-01 20:01 鸽鸽的书房 阅读(24) 评论(0) 推荐(0) 编辑
摘要: In statistics and probability theory, the tilde means "is distributed as";[13] see random variable(e.g. X ~ B(n,p) for a binomial distribution). (http 阅读全文
posted @ 2023-07-26 13:35 鸽鸽的书房 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 先放上课程上有同学分享的思维导图: ![](https://img2023.cnblogs.com/blog/2140966/202307/2140966-20230725171142945-1531191197.png) 划重点(用数学能更精确地描述强化学习的概念和过程): 强化学习:$O_t, 阅读全文
posted @ 2023-07-25 15:05 鸽鸽的书房 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 概率论与数理统计 $$ \begin{array}{ll} \operatorname{Pr}\{X=x\} & \text { probability that a random variable } X \text { takes on the value } x \\ X \sim p & \ 阅读全文
posted @ 2023-07-22 11:45 鸽鸽的书房 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 图的作用: 图结构捕捉不同类型节点(即用户、项目和属性)之间丰富的关联信息,使我们能够发现协作用户对属性和项目的偏好。因此,我们可以利用图结构将推荐和对话组件有机地整合在一起,其中对话会话可以被视为在图中维护的节点序列,以动态地利用对话历史来预测下一轮的行动。 由四个主要组件组成:基于图的 MDP 阅读全文
posted @ 2023-07-17 22:51 鸽鸽的书房 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 论文: Multi-Task Recommendations with Reinforcement Learning 地址: https://arxiv.org/abs/2302.03328 # 摘要 In recent years, Multi-task Learning (MTL) has yi 阅读全文
posted @ 2023-07-17 20:21 鸽鸽的书房 阅读(148) 评论(0) 推荐(0) 编辑