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

经过简单设置后,MOSS可以在16GB显存的单张显卡上运行 #35

Open
lwh9346 opened this issue Apr 22, 2023 · 9 comments
Open

Comments

@lwh9346
Copy link

lwh9346 commented Apr 22, 2023

image
16G显存+32G内存勉强运行,速度比较慢,但也算可以用
只需要把moss_cli_demo.py中31至33行进行简单修改即可

model = load_checkpoint_and_dispatch(
    raw_model, model_path, device_map="auto", no_split_module_classes=["MossBlock"], dtype=torch.float16, max_memory={0: "12GiB", "cpu": "26GiB"}
)

这边最大GPU内存设置为12GB是为了给CUDA kernels留出空间以避免OOM
参考:accelerate usage guides

希望可以帮到没有很多卡的业余玩家

@stevezhang88
Copy link

人才啊。 GPU不够的地方用CPU来补充吗?

@stevezhang88
Copy link

我使用load in 8 bit, 成功加载模型。运行速度也很快。比你这个方法的速度要快。基本上秒出。 我是3090, 24G , 单卡单机。

@lwh9346
Copy link
Author

lwh9346 commented Apr 22, 2023

我使用load in 8 bit, 成功加载模型。运行速度也很快。比你这个方法的速度要快。基本上秒出。 我是3090, 24G , 单卡单机。

不知道load_checkpoint_and_dispatchload_in_8bit能不能一起用?如果可以的话就可以在更低显存的设备上运行,在中等显存的的机器上避免内存带宽限制导致的性能下降了。

@licongguan
Copy link

我使用load in 8 bit, 成功加载模型。运行速度也很快。比你这个方法的速度要快。基本上秒出。 我是3090, 24G , 单卡单机。

请问如何修改代码?

@stevezhang88
Copy link

我使用load in 8 bit, 成功加载模型。运行速度也很快。比你这个方法的速度要快。基本上秒出。 我是3090, 24G , 单卡单机。

请问如何修改代码?

#38

@Jack-Ye
Copy link

Jack-Ye commented Apr 22, 2023

"12GiB"改成"8GiB" 可以在4070ti 12GB的显卡上跑起来, 就是回答需要5分钟

@wktdwktd
Copy link

我买的阿里云gpu服务器,30GiB显存,回答都很慢 十几秒,你们怎么忍受的?
max_memory={0: "30GiB", "cpu": "60GiB"}

@PangXitong
Copy link

请问您用的是windows系统吗,您能否将您更改后的moss_cli_demo.py发送过来,谢谢!

@wanglaiqi
Copy link

尝试使用load_in_8bit 加载 int4的模型,在NVIDIA GeForce RTX 3090 24G一块卡上运行很慢,生成一篇600字的文章要4minute

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

7 participants