Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
ai
chatCSDN
提交
cf2bc522
C
chatCSDN
项目概览
CSDN 技术社区
/
ai
/
chatCSDN
通知
108
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
chatCSDN
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
“a81cb9a2d939676dee6911993a37fa7e818ab72e”上不存在“fs/git@gitcode.net:openeuler/raspberrypi-kernel.git”
提交
cf2bc522
编写于
2年前
作者:
U
u010280923
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt ppo model
上级
b7f231a9
master
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
4 addition
and
9 deletion
+4
-9
README.md
README.md
+1
-1
src/rlhf/ppo.py
src/rlhf/ppo.py
+3
-8
未找到文件。
README.md
浏览文件 @
cf2bc522
...
...
@@ -83,7 +83,7 @@ python train_ppo.py --load_sft_model "./out_sft/rwkv-190.pth" --load_rm_model "
--ctx_len 1024 --epoch_steps 200 --epoch_count 1000 --epoch_begin 0 --epoch_save 2 \
--micro_bsz 2 --n_layer 24 --n_embd 2048 --pre_ffn 0 --head_qk 0 \
--lr_init 1e-5 --lr_final 1e-5 --warmup_steps 0 --beta1 0.9 --beta2 0.999 --adam_eps 1e-8 \
--accelerator gpu --devices 1 --precision bf16 --strategy deepspeed_stage_2_offload --grad_cp
0
\
--accelerator gpu --devices 1 --precision bf16 --strategy deepspeed_stage_2_offload --grad_cp
1
\
--my_qa_mask 1
```
...
...
This diff is collapsed.
Click to expand it.
src/rlhf/ppo.py
浏览文件 @
cf2bc522
...
...
@@ -71,8 +71,7 @@ class ActorCritic(nn.Module):
state
,
max_seq_len
,
eos_token
=
None
,
return_values
=
False
,
**
kwargs
return_values
=
False
):
# 产生一条 response,相当于采取了一次 action
actions
=
self
.
actor
.
generate
(
...
...
@@ -324,10 +323,8 @@ class RLHF(pl.LightningModule):
def
generate
(
self
,
max_seq_len
,
*
args
,
prompt
,
num_samples
=
4
,
# sample 4 per prompt and select the one with highest reward
**
kwargs
num_samples
=
4
# sample 4 per prompt and select the one with highest reward
):
''' 未参与训练,仅推理时使用
'''
...
...
@@ -345,10 +342,8 @@ class RLHF(pl.LightningModule):
_
)
=
self
.
actor_critic
.
generate
(
prompt
,
*
args
,
max_seq_len
=
max_seq_len
,
return_values
=
False
,
**
kwargs
return_values
=
False
)
rewards
=
self
.
reward_model
(
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部