ymcui / Chinese-LLaMA-Alpaca-2

中文LLaMA-2 & Alpaca-2大模型二期项目 + 64K超长上下文模型 (Chinese LLaMA-2 & Alpaca-2 LLMs with 64K long context models)
Apache License 2.0
7k stars 570 forks source link

在精调的时候,如何让模型在指定的GPU上运行,而不是只在cuda:0上 #544

Closed ZhenHengDong closed 3 months ago

ZhenHengDong commented 3 months ago

提交前必须检查以下项目

问题类型

None

基础模型

None

操作系统

None

详细描述问题

根据指令精调模型进行微调时,发现只能在cuda:0上运行,我想指定device = torch.device("cuda:3" if torch.cuda.is_available() else "cpu"),但是又不生效,请问如何指定模型运行的GPU呢?

依赖情况(代码类问题务必提供)

# 请在此处粘贴依赖情况(请粘贴在本代码块里)

运行日志或截图

# 请在此处粘贴运行日志(请粘贴在本代码块里)
iMountTai commented 3 months ago

在运行脚本的最开始添加CUDA_VISIBLE_DEVICES=3 torchrun ……

ZhenHengDong commented 3 months ago

在运行脚本的最开始添加CUDA_VISIBLE_DEVICES=3 torchrun ……

非常感谢🙏

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your consideration.

github-actions[bot] commented 3 months ago

Closing the issue, since no updates observed. Feel free to re-open if you need any further assistance.