Megatron-LM icon indicating copy to clipboard operation
Megatron-LM copied to clipboard

FileNotFoundError Issues while running on 2 nodes

Open zarzen opened this issue 6 years ago • 4 comments

Hi there, I want to run distributed training on two servers, each has 4 GPUs. I have modified the examples/pretrain_bert_distributed.sh file accordingly, as following:

# this is config on node-1
GPUS_PER_NODE=4
# Change for multinode config
MASTER_ADDR=<peer-ip>
MASTER_PORT=6000
NNODES=2
NODE_RANK=1
WORLD_SIZE=$(($GPUS_PER_NODE*$NNODES))

I can successfully run master process on node-0. While when I launch bash examples/pretrain_bert_distributed.sh on node-1. I will got an error as following:

Traceback (most recent call last):
  File "pretrain_bert.py", line 122, in <module>
Traceback (most recent call last):
  File "pretrain_bert.py", line 122, in <module>
    args_defaults={'tokenizer_type': 'BertWordPieceLowerCase'})
  File "/home/ubuntu/Megatron-LM/megatron/training.py", line 85, in pretrain
    args_defaults={'tokenizer_type': 'BertWordPieceLowerCase'})
  File "/home/ubuntu/Megatron-LM/megatron/training.py", line 85, in pretrain
    train_valid_test_dataset_provider)
  File "/home/ubuntu/Megatron-LM/megatron/training.py", line 496, in build_train_valid_test_data_iterators
    train_valid_test_dataset_provider)
  File "/home/ubuntu/Megatron-LM/megatron/training.py", line 496, in build_train_valid_test_data_iterators
    train_val_test_num_samples)
  File "pretrain_bert.py", line 113, in train_valid_test_datasets_provider
    train_val_test_num_samples)
  File "pretrain_bert.py", line 113, in train_valid_test_datasets_provider
    skip_warmup=(not args.mmap_warmup))
  File "/home/ubuntu/Megatron-LM/megatron/data/bert_dataset.py", line 95, in build_train_valid_test_datasets
    skip_warmup=(not args.mmap_warmup))
  File "/home/ubuntu/Megatron-LM/megatron/data/bert_dataset.py", line 95, in build_train_valid_test_datasets
    train_dataset = build_dataset(0, 'train')
  File "/home/ubuntu/Megatron-LM/megatron/data/bert_dataset.py", line 86, in build_dataset
    train_dataset = build_dataset(0, 'train')
  File "/home/ubuntu/Megatron-LM/megatron/data/bert_dataset.py", line 86, in build_dataset
    seed=seed)
  File "/home/ubuntu/Megatron-LM/megatron/data/bert_dataset.py", line 125, in __init__
    seed=seed)
  File "/home/ubuntu/Megatron-LM/megatron/data/bert_dataset.py", line 125, in __init__
    self.name)
  File "/home/ubuntu/Megatron-LM/megatron/data/bert_dataset.py", line 282, in get_samples_mapping_
    self.name)
  File "/home/ubuntu/Megatron-LM/megatron/data/bert_dataset.py", line 282, in get_samples_mapping_
    samples_mapping = np.load(indexmap_filename, allow_pickle=True)
  File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/numpy/lib/npyio.py", line 428, in load
    samples_mapping = np.load(indexmap_filename, allow_pickle=True)
  File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/numpy/lib/npyio.py", line 428, in load
    fid = open(os_fspath(file), "rb")
    fid = open(os_fspath(file), "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'my-bert_text_sentence_train_indexmap_32000000mns_512msl_0.10ssp_1234s.npy'
FileNotFoundError: [Errno 2] No such file or directory: 'my-bert_text_sentence_train_indexmap_32000000mns_512msl_0.10ssp_1234s.npy'

Does program assume different servers share data over the network? because I see the missing file actually generated at master node. If I copy *.npy files from node-0 to node-1, training runs.

zarzen avatar Jun 11 '20 01:06 zarzen

Hi there, I have met the exactly same question, do you find a way to solve it? Now I have to copy the *.npy files manually twice from node 0 to node 1 when I run a new model.

weigao266 avatar Feb 07 '22 07:02 weigao266

I think the system assumes the cluster is running with a shared file system like lustre.

zarzen avatar Feb 20 '22 13:02 zarzen

Hi there, I have met the exactly same question, do you find a way to solve it? Now I have to copy the *.npy files manually twice from node 0 to node 1 when I run a new model.

Did you ever find answer to this problem? Thanks

japarada avatar Sep 11 '23 18:09 japarada

Hi there, I have met the exactly same question, do you find a way to solve it? Now I have to copy the *.npy files manually twice from node 0 to node 1 when I run a new model.

Did you ever find answer to this problem? Thanks

If you don't plan to use a file sharing system like lustre, you'd have to manually copy and paste the dataset cache to all your nodes and comment out the self.unique_description_hash in megatron_dataset.py, otherwise it will try to load a new set of .npy files every time. Hope it helps!

mfdj2002 avatar Feb 11 '24 07:02 mfdj2002