merge codex/mf-loader-multiprocessing into master
2 file(s) changed+88-3
Mmindformers/dataset/dataloader/blended_megatron_dataloader.py+5-3
| @@ -1,4 +1,4 @@ | |||
| 1 | -# Copyright 2024 Huawei Technologies Co., Ltd | 1 | +# Copyright 2024-2026 Huawei Technologies Co., Ltd |
| 2 | # | 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. | 4 | # you may not use this file except in compliance with the License. |
| @@ -151,7 +151,8 @@ class MegatronDatasetBuilder: | |||
| 151 | shuffle=shuffle, | 151 | shuffle=shuffle, |
| 152 | num_shards=num_shards, | 152 | num_shards=num_shards, |
| 153 | shard_id=shard_id, | 153 | shard_id=shard_id, |
| 154 | - num_parallel_workers=kwargs.get('num_parallel_workers', 1)) | 154 | + num_parallel_workers=kwargs.get('num_parallel_workers', 1), |
| 155 | + python_multiprocessing=kwargs.get('python_multiprocessing', True)) | ||
| 155 | return gen_dataset | 156 | return gen_dataset |
| 156 | 157 | ||
| 157 | if get_real_group_size() > 1 and get_context('mode') != MODE['PYNATIVE_MODE']: | 158 | if get_real_group_size() > 1 and get_context('mode') != MODE['PYNATIVE_MODE']: |
| @@ -173,7 +174,8 @@ class MegatronDatasetBuilder: | |||
| 173 | column_names=source.cols(), | 174 | column_names=source.cols(), |
| 174 | shuffle=False, | 175 | shuffle=False, |
| 175 | num_shards=num_shards, | 176 | num_shards=num_shards, |
| 176 | - shard_id=shard_id) # keep the same sharding as real dataset | 177 | + shard_id=shard_id, |
| 178 | + python_multiprocessing=kwargs.get('python_multiprocessing', True)) | ||
| 177 | skip_barrier_controller(times=2) | 179 | skip_barrier_controller(times=2) |
| 178 | else: | 180 | else: |
| 179 | gen_dataset = build_gpt_dataset() | 181 | gen_dataset = build_gpt_dataset() |
Atests/st/test_ut/test_dataset/test_dataloader/test_blended_megatron_kwargs.py+83-0
Comments
Sign in to comment