namisan / mt-dnn

Multi-Task Deep Neural Networks for Natural Language Understanding
MIT License
2.22k stars 412 forks source link

ddp error in fintune the task-specific like rte #254

Closed Xnhyacinth closed 1 year ago

Xnhyacinth commented 1 year ago
Traceback (most recent call last):
  File "/data/liaohuanxuan/mt-dnn/train.py", line 793, in <module>
    main()
  File "/data/liaohuanxuan/mt-dnn/train.py", line 681, in main
    model.update(batch_meta, batch_data)
  File "/data/liaohuanxuan/mt-dnn/mt_dnn/model.py", line 260, in update
    logits = self.mnetwork(*inputs)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 1040, in forward
    output = self._run_ddp_forward(*inputs, **kwargs)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/nn/parallel/distributed.py", line 1000, in _run_ddp_forward
    return module_to_run(*inputs[0], **kwargs[0])
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/data/liaohuanxuan/mt-dnn/mt_dnn/matcher.py", line 151, in forward
    last_hidden_state, all_hidden_states = self.encode(
  File "/data/liaohuanxuan/mt-dnn/mt_dnn/matcher.py", line 110, in encode
    outputs = self.bert(
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py", line 1011, in forward
    embedding_output = self.embeddings(
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/transformers/models/bert/modeling_bert.py", line 235, in forward
    inputs_embeds = self.word_embeddings(input_ids)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/nn/modules/sparse.py", line 160, in forward
    return F.embedding(
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/nn/functional.py", line 2210, in embedding
    return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:1 and cuda:0! (when checking argument for argument index in method wrapper__index_select)
WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 9696 closing signal SIGTERM
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 1 (pid: 9697) of binary: /data/liaohuanxuan/micromamba/envs/former/bin/python
Traceback (most recent call last):
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/distributed/launch.py", line 195, in <module>
    main()
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/distributed/launch.py", line 191, in main
    launch(args)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/distributed/launch.py", line 176, in launch
    run(args)
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/distributed/run.py", line 753, in run
    elastic_launch(
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "/data/liaohuanxuan/micromamba/envs/former/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 246, in launch_agent
    raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError: 
============================================================
train.py FAILED
------------------------------------------------------------
Failures:
  <NO_OTHER_FAILURES>
------------------------------------------------------------
Root Cause (first observed failure):
[0]:
  time      : 2023-06-17_05:55:32
  host      : ubuntu138
  rank      : 1 (local_rank: 1)
  exitcode  : 1 (pid: 9697)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
============================================================

why it error on the not same device