Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Anthony Larcher
sidekit
Commits
1873385c
Commit
1873385c
authored
Apr 12, 2021
by
Anthony Larcher
Browse files
parallel
parent
4414cb29
Changes
1
Show whitespace changes
Inline
Side-by-side
nnet/xvector.py
View file @
1873385c
...
...
@@ -1311,7 +1311,6 @@ def new_xtrain(dataset_description,
# Set the device and manage parallel processing
device
=
torch
.
cuda
.
device
(
local_rank
)
torch
.
cuda
.
set_device
(
local_rank
)
#device = torch.device("cuda")
model
.
to
(
device
)
# If multi-gpu
...
...
@@ -1333,16 +1332,15 @@ def new_xtrain(dataset_description,
if
local_rank
<
1
:
print
(
"Let's use"
,
torch
.
cuda
.
device_count
(),
"GPUs!"
)
torch
.
distributed
.
init_process_group
(
backend
=
'nccl'
,
init_method
=
'env://'
)
model
=
torch
.
nn
.
parallel
.
DistributedDataParallel
(
model
,
model
=
torch
.
nn
.
parallel
.
DistributedDataParallel
(
model
,
device_ids
=
[
local_rank
],
output_device
=
local_rank
)
output_device
=
local_rank
)
else
:
print
(
"Train on a single GPU"
)
# Initialise data loaders
training_loader
,
validation_loader
,
sampler
,
validation_tar_indices
,
validation_non_indices
=
get_loaders
(
dataset_opts
,
training_loader
,
validation_loader
,
\
sampler
,
validation_tar_indices
,
validation_non_indices
=
get_loaders
(
dataset_opts
,
training_opts
,
speaker_number
)
...
...
@@ -1372,6 +1370,8 @@ def new_xtrain(dataset_description,
break
sampler
.
set_epoch
(
epoch
)
if
training_opts
[
"multi_gpu"
]:
torch
.
distributed
.
barrier
()
model
=
new_train_epoch
(
model
,
training_opts
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment