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
1a3f5663
"src/vscode:/vscode.git/clone" did not exist on "fa3c86beaf04e297d4b0e824692e3bd4edfb5f22"
Commit
1a3f5663
authored
Apr 14, 2020
by
Neel Kant
Browse files
Rename variables
parent
360885ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
ict_qualitative_test.py
ict_qualitative_test.py
+20
-18
No files found.
ict_qualitative_test.py
View file @
1a3f5663
...
...
@@ -24,27 +24,27 @@ def main():
all_input_tokens
=
[]
all_input_logits
=
[]
all_
d
oc_tokens
=
[]
all_
d
oc_logits
=
[]
all_
bl
oc
k
_tokens
=
[]
all_
bl
oc
k
_logits
=
[]
for
i
in
range
(
100
):
input_tokens
,
input_types
,
input_pad_mask
,
d
oc_tokens
,
d
oc_token_types
,
d
oc_pad_mask
=
get_batch
(
data_iter
)
input_tokens
,
input_types
,
input_pad_mask
,
bl
oc
k
_tokens
,
bl
oc
k
_token_types
,
bl
oc
k
_pad_mask
=
get_batch
(
data_iter
)
input_logits
,
doc_logits
,
_
=
model
.
module
.
module
.
forward
(
input_tokens
,
input_types
,
input_pad_mask
,
d
oc_tokens
,
d
oc_pad_mask
,
d
oc_token_types
,
return_logits
=
True
)
input_tokens
,
input_types
,
input_pad_mask
,
bl
oc
k
_tokens
,
bl
oc
k
_pad_mask
,
bl
oc
k
_token_types
,
return_logits
=
True
)
all_input_tokens
.
append
(
input_tokens
.
detach
().
cpu
().
numpy
())
all_input_logits
.
append
(
input_logits
.
detach
().
cpu
().
numpy
())
all_
d
oc_tokens
.
append
(
d
oc_tokens
.
detach
().
cpu
().
numpy
())
all_
d
oc_logits
.
append
(
doc_logits
.
detach
().
cpu
().
numpy
())
all_
bl
oc
k
_tokens
.
append
(
bl
oc
k
_tokens
.
detach
().
cpu
().
numpy
())
all_
bl
oc
k
_logits
.
append
(
doc_logits
.
detach
().
cpu
().
numpy
())
all_input
s
_tokens
=
np
.
array
(
all_input_tokens
).
reshape
(
-
1
,
args
.
seq_length
)
all_input
s
_logits
=
np
.
array
(
all_input_logits
).
reshape
(
-
1
,
128
)
all_
d
oc_tokens
=
np
.
array
(
all_
d
oc_tokens
).
reshape
(
-
1
,
args
.
seq_length
)
all_
d
oc_logits
=
np
.
array
(
all_
d
oc_logits
).
reshape
(
-
1
,
128
)
all_input_tokens
=
np
.
array
(
all_input_tokens
).
reshape
(
-
1
,
args
.
seq_length
)
all_input_logits
=
np
.
array
(
all_input_logits
).
reshape
(
-
1
,
128
)
all_
bl
oc
k
_tokens
=
np
.
array
(
all_
bl
oc
k
_tokens
).
reshape
(
-
1
,
args
.
seq_length
)
all_
bl
oc
k
_logits
=
np
.
array
(
all_
bl
oc
k
_logits
).
reshape
(
-
1
,
128
)
np
.
save
(
'input_tokens.npy'
,
all_input_tokens
)
np
.
save
(
'input_logits.npy'
,
all_input_logits
)
np
.
save
(
'
d
oc_tokens.npy'
,
all_
d
oc_tokens
)
np
.
save
(
'doc_logits.npy'
,
all_
d
oc_logits
)
np
.
save
(
'
bl
oc
k
_tokens.npy'
,
all_
bl
oc
k
_tokens
)
np
.
save
(
'doc_logits.npy'
,
all_
bl
oc
k
_logits
)
def
load_checkpoint
():
...
...
@@ -75,17 +75,19 @@ def load_checkpoint():
def
get_dataset
():
args
=
get_args
()
indexed_dataset
=
get_indexed_dataset_
(
args
.
data_path
,
'mmap'
,
True
)
block_dataset
=
get_indexed_dataset_
(
args
.
data_path
,
'mmap'
,
True
)
titles_dataset
=
get_indexed_dataset_
(
args
.
data_path
+
'-titles'
,
'mmap'
,
True
)
doc_idx_ptr
=
indexed
_dataset
.
get_doc_idx
()
total_num_documents
=
indexed
_dataset
.
doc_idx
.
shape
[
0
]
-
1
indexed
_dataset
.
set_doc_idx
(
doc_idx_ptr
[
0
:
total_num_documents
])
doc_idx_ptr
=
block
_dataset
.
get_doc_idx
()
total_num_documents
=
block
_dataset
.
doc_idx
.
shape
[
0
]
-
1
block
_dataset
.
set_doc_idx
(
doc_idx_ptr
[
0
:
total_num_documents
])
kwargs
=
dict
(
name
=
'full'
,
indexed_dataset
=
indexed_dataset
,
context_dataset
=
block_dataset
,
titles_dataset
=
titles_dataset
,
data_prefix
=
args
.
data_path
,
num_epochs
=
None
,
max_num_samples
=
total_num_documents
,
max_num_samples
=
total_num_documents
*
3
,
max_seq_length
=
288
,
# doesn't matter
short_seq_prob
=
0.0001
,
# doesn't matter
seed
=
1
...
...
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