Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add use_shared_memory params for AIstudio demo #1707

Merged
merged 1 commit into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion configs/det/det_mv3_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Train:
drop_last: False
batch_size_per_card: 16
num_workers: 8
use_shared_memory: False

Eval:
dataset:
Expand All @@ -128,4 +129,5 @@ Eval:
shuffle: False
drop_last: False
batch_size_per_card: 1 # must be 1
num_workers: 8
num_workers: 8
use_shared_memory: False
2 changes: 2 additions & 0 deletions configs/rec/rec_icdar15_train.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Train:
batch_size_per_card: 256
drop_last: True
num_workers: 8
use_shared_memory: False

Eval:
dataset:
Expand All @@ -96,3 +97,4 @@ Eval:
drop_last: False
batch_size_per_card: 256
num_workers: 4
use_shared_memory: False
7 changes: 4 additions & 3 deletions ppocr/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@ def build_dataloader(config, mode, device, logger):
batch_size = loader_config['batch_size_per_card']
drop_last = loader_config['drop_last']
num_workers = loader_config['num_workers']

use_shared_memory = False
if 'use_shared_memory' in loader_config.keys():
use_shared_memory = loader_config['use_shared_memory']
else:
use_shared_memory = True
if mode == "Train":
#Distribute data to multiple cards
batch_sampler = DistributedBatchSampler(
dataset=dataset,
batch_size=batch_size,
shuffle=False,
drop_last=drop_last)
use_shared_memory = True
else:
#Distribute data to single card
batch_sampler = BatchSampler(
Expand Down