提交 825a2824 编写于 作者: L LDOUBLEV

add use_shared_memory params for AIstudio demo

上级 ccfc7544
...@@ -102,6 +102,7 @@ Train: ...@@ -102,6 +102,7 @@ Train:
drop_last: False drop_last: False
batch_size_per_card: 16 batch_size_per_card: 16
num_workers: 8 num_workers: 8
use_shared_memory: False
Eval: Eval:
dataset: dataset:
...@@ -128,4 +129,5 @@ Eval: ...@@ -128,4 +129,5 @@ Eval:
shuffle: False shuffle: False
drop_last: False drop_last: False
batch_size_per_card: 1 # must be 1 batch_size_per_card: 1 # must be 1
num_workers: 8 num_workers: 8
\ No newline at end of file use_shared_memory: False
\ No newline at end of file
...@@ -76,6 +76,7 @@ Train: ...@@ -76,6 +76,7 @@ Train:
batch_size_per_card: 256 batch_size_per_card: 256
drop_last: True drop_last: True
num_workers: 8 num_workers: 8
use_shared_memory: False
Eval: Eval:
dataset: dataset:
...@@ -96,3 +97,4 @@ Eval: ...@@ -96,3 +97,4 @@ Eval:
drop_last: False drop_last: False
batch_size_per_card: 256 batch_size_per_card: 256
num_workers: 4 num_workers: 4
use_shared_memory: False
...@@ -66,8 +66,10 @@ def build_dataloader(config, mode, device, logger): ...@@ -66,8 +66,10 @@ def build_dataloader(config, mode, device, logger):
batch_size = loader_config['batch_size_per_card'] batch_size = loader_config['batch_size_per_card']
drop_last = loader_config['drop_last'] drop_last = loader_config['drop_last']
num_workers = loader_config['num_workers'] num_workers = loader_config['num_workers']
if 'use_shared_memory' in loader_config.keys():
use_shared_memory = False use_shared_memory = loader_config['use_shared_memory']
else:
use_shared_memory = True
if mode == "Train": if mode == "Train":
#Distribute data to multiple cards #Distribute data to multiple cards
batch_sampler = DistributedBatchSampler( batch_sampler = DistributedBatchSampler(
...@@ -75,7 +77,6 @@ def build_dataloader(config, mode, device, logger): ...@@ -75,7 +77,6 @@ def build_dataloader(config, mode, device, logger):
batch_size=batch_size, batch_size=batch_size,
shuffle=False, shuffle=False,
drop_last=drop_last) drop_last=drop_last)
use_shared_memory = True
else: else:
#Distribute data to single card #Distribute data to single card
batch_sampler = BatchSampler( batch_sampler = BatchSampler(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册