Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Fairseq
Commits
813352e1
"vscode:/vscode.git/clone" did not exist on "78031c29383852efce15d8d9a79d2d985394623a"
Commit
813352e1
authored
Sep 27, 2017
by
Myle Ott
Browse files
Don't save/restore convolutional layers in incremental inference
parent
cb0d7b2a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
fairseq/models/fconv.py
fairseq/models/fconv.py
+2
-4
No files found.
fairseq/models/fconv.py
View file @
813352e1
...
@@ -284,9 +284,8 @@ class Decoder(nn.Module):
...
@@ -284,9 +284,8 @@ class Decoder(nn.Module):
'already performing incremental inference'
'already performing incremental inference'
self
.
_is_inference_incremental
=
True
self
.
_is_inference_incremental
=
True
# save original forward
and convolution layers
# save original forward
self
.
_orig_forward
=
self
.
forward
self
.
_orig_forward
=
self
.
forward
self
.
_orig_conv
=
self
.
convolutions
# switch to incremental forward
# switch to incremental forward
self
.
forward
=
self
.
_incremental_forward
self
.
forward
=
self
.
_incremental_forward
...
@@ -295,9 +294,8 @@ class Decoder(nn.Module):
...
@@ -295,9 +294,8 @@ class Decoder(nn.Module):
self
.
start_fresh_sequence
(
beam_size
)
self
.
start_fresh_sequence
(
beam_size
)
def
_stop_incremental_inference
(
self
):
def
_stop_incremental_inference
(
self
):
# restore original forward
and convolution layers
# restore original forward
self
.
forward
=
self
.
_orig_forward
self
.
forward
=
self
.
_orig_forward
self
.
convolutions
=
self
.
_orig_conv
self
.
_is_inference_incremental
=
False
self
.
_is_inference_incremental
=
False
...
...
Write
Preview
Markdown
is supported
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