Skip to content

Commit

Permalink
[Bug Fix]Fix nightly gpu test (facebookresearch#2396)
Browse files Browse the repository at this point in the history
* fix nightly gpu test

* fix format
  • Loading branch information
dexterju27 authored Feb 11, 2020
1 parent df8926a commit ae40e63
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions parlai/agents/transformer/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,14 @@ def _build_encoder(
n_positions=1024,
n_segments=0,
):
n_layers = (
opt['n_encoder_layers']
if opt.get('n_encoder_layers', -1) > 0
else opt['n_layers']
)
return TransformerEncoder(
n_heads=opt['n_heads'],
n_layers=(
opt['n_encoder_layers'] if opt['n_encoder_layers'] > 0 else opt['n_layers']
),
n_layers=n_layers,
embedding_size=opt['embedding_size'],
ffn_size=opt['ffn_size'],
vocabulary_size=len(dictionary),
Expand All @@ -96,11 +99,14 @@ def _build_encoder(
def _build_decoder(
opt, dictionary, embedding=None, padding_idx=None, n_positions=1024, n_segments=0
):
n_layers = (
opt['n_decoder_layers']
if opt.get('n_decoder_layers', -1) > 0
else opt['n_layers']
)
return TransformerDecoder(
n_heads=opt['n_heads'],
n_layers=(
opt['n_decoder_layers'] if opt['n_decoder_layers'] > 0 else opt['n_layers']
),
n_layers=n_layers,
embedding_size=opt['embedding_size'],
ffn_size=opt['ffn_size'],
vocabulary_size=len(dictionary),
Expand Down

0 comments on commit ae40e63

Please sign in to comment.