liuqidong07 / LEADER-pytorch

[arXiv'24] The official implementation code of LEADER.
https://arxiv.org/abs/2402.02803
MIT License
15 stars 3 forks source link

运行问题:RuntimeError: ProcessGroupNCCL is only supported with GPUs, no GPUs found! #2

Closed He-Yichen closed 6 months ago

He-Yichen commented 6 months ago

作者您好,我尝试复现您的代码时,出现以下的错误,Pytorch版本我用的也是1.12.0+cu102,但是torch显示是可用的,

import torch
if __name__ == "__main__":
    print("Cuda support:", torch.cuda.is_available(),":", torch.cuda.device_count(), "devices")
    accelerator = Accelerator()
    print(accelerator.state)

输出: Cuda support: True : 1 devices Distributed environment: NO Num processes: 1 Process index: 0 Local process index: 0 Device: cuda

Mixed precision type: no

具体报错如下,您能帮我解决一下问题吗? 另外requirements.txt中trl==0.7.6需要transformers>=4.31.0,但是在文件中使用的是4.28.1的transformers包,这是否会有问题呢?

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /home/heyichen/LEADER-pytorch/main_llm_cls.py:216 in │ │ │ │ 213 │ │ 214 if name == "main": │ │ 215 │ │ │ ❱ 216 │ train() │ │ 217 │ │ 218 │ │ 219 │ │ │ │ /home/heyichen/LEADER-pytorch/main_llm_cls.py:60 in train │ │ │ │ 57 def train(): │ │ 58 │ │ │ 59 │ parser = HfArgumentParser((ModelArguments, DataTrainingArguments, Seq2SeqTrainingArg │ │ ❱ 60 │ model_args, data_args, training_args = parser.parse_args_into_dataclasses() │ │ 61 │ device_map = "auto" │ │ 62 │ │ │ 63 │ # load diag, proc, med word2id tokenizer │ │ │ │ /home/heyichen/.conda/envs/LEADER/lib/python3.9/site-packages/transformers/hf_argparser.py:332 │ │ in parse_args_into_dataclasses │ │ │ │ 329 │ │ │ inputs = {k: v for k, v in vars(namespace).items() if k in keys} │ │ 330 │ │ │ for k in keys: │ │ 331 │ │ │ │ delattr(namespace, k) │ │ ❱ 332 │ │ │ obj = dtype(**inputs) │ │ 333 │ │ │ outputs.append(obj) │ │ 334 │ │ if len(namespace.dict) > 0: │ │ 335 │ │ │ # additional namespace. │ │ in init:115 │ │ │ │ /home/heyichen/.conda/envs/LEADER/lib/python3.9/site-packages/transformers/training_args.py:1259 │ │ in post_init │ │ │ │ 1256 │ │ if ( │ │ 1257 │ │ │ self.framework == "pt" │ │ 1258 │ │ │ and is_torch_available() │ │ ❱ 1259 │ │ │ and (self.device.type != "cuda") │ │ 1260 │ │ │ and (get_xla_device_type(self.device) != "GPU") │ │ 1261 │ │ │ and (self.fp16 or self.fp16_full_eval) │ │ 1262 │ │ ): │ │ │ │ /home/heyichen/.conda/envs/LEADER/lib/python3.9/site-packages/transformers/training_args.py:1694 │ │ in device │ │ │ │ 1691 │ │ The device used by this process. │ │ 1692 │ │ """ │ │ 1693 │ │ requires_backends(self, ["torch"]) │ │ ❱ 1694 │ │ return self._setup_devices │ │ 1695 │ │ │ 1696 │ @property │ │ 1697 │ def n_gpu(self): │ │ │ │ /home/heyichen/.conda/envs/LEADER/lib/python3.9/site-packages/transformers/utils/generic.py:54 │ │ in get │ │ │ │ 51 │ │ attr = "cached_" + self.fget.name__ │ │ 52 │ │ cached = getattr(obj, attr, None) │ │ 53 │ │ if cached is None: │ │ ❱ 54 │ │ │ cached = self.fget(obj) │ │ 55 │ │ │ setattr(obj, attr, cached) │ │ 56 │ │ return cached │ │ 57 │ │ │ │ /home/heyichen/.conda/envs/LEADER/lib/python3.9/site-packages/transformers/training_args.py:1679 │ │ in _setup_devices │ │ │ │ 1676 │ │ │ │ if self.xpu_backend and self.xpu_backend in ("mpi", "gloo"): │ │ 1677 │ │ │ │ │ torch.distributed.init_process_group(backend=self.xpu_backend, timeo │ │ 1678 │ │ │ │ else: │ │ ❱ 1679 │ │ │ │ │ torch.distributed.init_process_group(backend="nccl", timeout=self.dd │ │ 1680 │ │ │ device = torch.device("cuda", self.local_rank) │ │ 1681 │ │ │ self._n_gpu = 1 │ │ 1682 │ │ │ │ /home/heyichen/.conda/envs/LEADER/lib/python3.9/site-packages/torch/distributed/distributed_c10d │ │ .py:602 in init_process_group │ │ │ │ 599 │ │ │ # different systems (e.g. RPC) in case the store is multi-tenant. │ │ 600 │ │ │ store = PrefixStore("default_pg", store) │ │ 601 │ │ │ │ ❱ 602 │ │ default_pg = _new_process_group_helper( │ │ 603 │ │ │ world_size, │ │ 604 │ │ │ rank, │ │ 605 │ │ │ [], │ │ │ │ /home/heyichen/.conda/envs/LEADER/lib/python3.9/site-packages/torch/distributed/distributed_c10d │ │ .py:738 in _new_process_group_helper │ │ │ │ 735 │ │ │ │ pg_options.is_high_priority_stream = False │ │ 736 │ │ │ │ pg_options._timeout = timeout │ │ 737 │ │ │ │ │ ❱ 738 │ │ │ pg = ProcessGroupNCCL(prefix_store, rank, world_size, pg_options) │ │ 739 │ │ │ # In debug mode and if GLOO is available, wrap in a wrapper PG that │ │ 740 │ │ │ # enables enhanced collective checking for debugability. │ │ 741 │ │ │ if get_debug_level() == DebugLevel.DETAIL: │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ RuntimeError: ProcessGroupNCCL is only supported with GPUs, no GPUs found!

liuqidong07 commented 6 months ago

哈喽,

  1. 我看您是只有一个GPU吗,是不是用我代码里的bash跑的?如果一个GPU的话不要用deepspeed来跑。
  2. 我最后代码里没有用到trl package,所以安装transformers的4.28.1版本就好。 祝好
He-Yichen commented 6 months ago

@liuqidong07 谢谢作者!我目前使用的服务器只有一个GTX 3090Ti (24G),请问如果要复现这个模型,最低显存要求是多少呢?实验室目前还有一块Tesla T4(16G),如果使用两个显卡,可以复现您的模型吗? 再次感谢,祝好!

liuqidong07 commented 6 months ago

哈喽, 本文所提到的大模型使用了4张V100 32G并行训练,对于MIMIC-III数据集,训练时间大约需要12个小时。24G的显卡LLaMA-7B应该是可以塞进去的,但是batch size可能会设置得很小,导致训练时间成倍数增加。感觉如果是单卡3090Ti训练应该需要上百个小时。我之后想办法上传我训练好的checkpoint,以方便直接进行推理测试。感谢对我们工作的关注。 祝好

He-Yichen commented 6 months ago

哈喽, 本文所提到的大模型使用了4张V100 32G并行训练,对于MIMIC-III数据集,训练时间大约需要12个小时。24G的显卡LLaMA-7B应该是可以塞进去的,但是batch size可能会设置得很小,导致训练时间成倍数增加。感觉如果是单卡3090Ti训练应该需要上百个小时。我之后想办法上传我训练好的checkpoint,以方便直接进行推理测试。感谢对我们工作的关注。 祝好

非常感谢您杰出的工作,祝好!