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

如何设置在原有的pytorch_model.bin基础上进行微调训练? #204

Closed
hdjlcbz opened this issue Oct 8, 2024 · 6 comments
Closed

Comments

@hdjlcbz
Copy link

hdjlcbz commented Oct 8, 2024

怎么在原有的模型基础上进行微调训练?

@foreverhell
Copy link

训练代码这个部分
image
把权重导入
weights = torch.load(unet_path)
unet.load_state_dict(weights)

@hnsywangxin
Copy link

训练代码这个部分 image 把权重导入 weights = torch.load(unet_path) unet.load_state_dict(weights)

按照该代码加载了权重,光unet显存占用都将近30G,然后bs=1都会报OOM(我每个卡40G显存),请问你也是消耗这么多显存嘛

@foreverhell
Copy link

训练代码这个部分 image 把权重导入 weights = torch.load(unet_path) unet.load_state_dict(weights)

按照该代码加载了权重,光unet显存占用都将近30G,然后bs=1都会报OOM(我每个卡40G显存),请问你也是消耗这么多显存嘛

是,weights可以先放在CPU上,保证unet在GPU就行

@hnsywangxin
Copy link

训练代码这个部分 image 把权重导入 weights = torch.load(unet_path) unet.load_state_dict(weights)

按照该代码加载了权重,光unet显存占用都将近30G,然后bs=1都会报OOM(我每个卡40G显存),请问你也是消耗这么多显存嘛

是,weights可以先放在CPU上,保证unet在GPU就行

已解决,谢谢

@sswax000643
Copy link

训练代码这个部分 image 把权重导入 weights = torch.load(unet_path) unet.load_state_dict(weights)

按照该代码加载了权重,光unet显存占用都将近30G,然后bs=1都会报OOM(我每个卡40G显存),请问你也是消耗这么多显存嘛

是,weights可以先放在CPU上,保证unet在GPU就行

已解决,谢谢

请问是如何解决的呢?可以分享下吗,我现在也是加载权重就爆显存

@hnsywangxin
Copy link

@sswax000643 问下gpt,或者谷歌查一下,有个关键字参数,这个不难

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

5 participants