Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haha, I use the GPU on my laptop, but I have to set BATCH_SIZE to 1 so I don't run out of memory,there are too many Total params #82

Open
Ding-Chian opened this issue Apr 21, 2024 · 1 comment

Comments

@Ding-Chian
Copy link

Haha, I use the GPU on my laptop, but I have to set BATCH_SIZE to 1 so I don't run out of memory,there are too many Total params

@Ding-Chian Ding-Chian changed the title set BATCH_SIZE to 1 Haha, I use the GPU on my laptop, but I have to set BATCH_SIZE to 1 so I don't run out of memory,there are too many Total params Apr 21, 2024
@Ding-Chian
Copy link
Author

Ding-Chian commented Apr 21, 2024

但是你可以在model.py中更改以下代码
for l in bert_model.layers:
l.trainable = True

#只是微调后8层(举个例子)
trainable_layers = 8 # 后八层
num_layers = len(bert_model.layers)
for i, layer in enumerate(bert_model.layers):
if i >= num_layers - trainable_layers:
layer.trainable = True
else:
layer.trainable = False
从而减少参数数量

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant