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
Megatron-LM
Commits
c044f59a
"vscode:/vscode.git/clone" did not exist on "757ecfb0adf2df031a4570430eaa9085fe20a5c0"
Commit
c044f59a
authored
Jun 05, 2020
by
Neel Kant
Browse files
Some changes noticed late
parent
32bb4edc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
9 deletions
+3
-9
megatron/model/__init__.py
megatron/model/__init__.py
+1
-1
megatron/model/realm_model.py
megatron/model/realm_model.py
+2
-8
No files found.
megatron/model/__init__.py
View file @
c044f59a
...
...
@@ -15,6 +15,6 @@
from
.distributed
import
*
from
.bert_model
import
BertModel
from
megatron.model.realm_model
import
ICTBertModel
,
REALMRetriever
,
REALMBertModel
from
megatron.model.realm_model
import
ICTBertModel
from
.gpt2_model
import
GPT2Model
from
.utils
import
get_params_for_weight_decay_optimization
megatron/model/realm_model.py
View file @
c044f59a
...
...
@@ -42,14 +42,8 @@ class ICTBertModel(MegatronModule):
self
.
block_model
=
BertModel
(
**
bert_args
)
self
.
_block_key
=
'context_model'
def
forward
(
self
,
query_tokens
,
query_attention_mask
,
block_tokens
,
block_attention_mask
,
only_query
=
False
,
only_block
=
False
):
"""Run a forward pass for each of the models and compute the similarity scores."""
if
only_query
:
return
self
.
embed_query
(
query_tokens
,
query_attention_mask
)
if
only_block
:
return
self
.
embed_block
(
block_tokens
,
block_attention_mask
)
def
forward
(
self
,
query_tokens
,
query_attention_mask
,
block_tokens
,
block_attention_mask
):
"""Run a forward pass for each of the models and return the respective embeddings."""
query_logits
=
self
.
embed_query
(
query_tokens
,
query_attention_mask
)
block_logits
=
self
.
embed_block
(
block_tokens
,
block_attention_mask
)
return
query_logits
,
block_logits
...
...
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