ymcui/Chinese-LLaMA-Alpaca-2

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

ZhenHengDong opened this issue · 4 comments

提交前必须检查以下项目

  • 请确保使用的是仓库最新代码(git pull),一些问题已被解决和修复。
  • 我已阅读项目文档FAQ章节并且已在Issue中对问题进行了搜索,没有找到相似问题和解决方案。
  • 第三方插件问题:例如llama.cppLangChaintext-generation-webui等,同时建议到对应的项目中查找解决方案。

问题类型

None

基础模型

None

操作系统

None

详细描述问题

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

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

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

运行日志或截图

# 请在此处粘贴运行日志(请粘贴在本代码块里)

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

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

非常感谢🙏

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.

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