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
wuxk1
Megatron-LM
Commits
84a43b13
"mmdet/vscode:/vscode.git/clone" did not exist on "830effcd2342cd169b2c8cbe0314e72299e28a32"
Commit
84a43b13
authored
Nov 29, 2022
by
Mike Chrzanowski
Committed by
Jared Casper
Nov 29, 2022
Browse files
bug fixes in partitioned data preprocessor
parent
8ce8256f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
megatron/tokenizer/tokenizer.py
megatron/tokenizer/tokenizer.py
+3
-1
tools/preprocess_data_partitions.py
tools/preprocess_data_partitions.py
+9
-5
No files found.
megatron/tokenizer/tokenizer.py
View file @
84a43b13
...
@@ -15,8 +15,10 @@ def build_tokenizer(args):
...
@@ -15,8 +15,10 @@ def build_tokenizer(args):
print
(
'> building {} tokenizer ...'
.
format
(
args
.
tokenizer_type
),
print
(
'> building {} tokenizer ...'
.
format
(
args
.
tokenizer_type
),
flush
=
True
)
flush
=
True
)
# Select and instantiate the t
okenizer
.
if
args
.
tokenizer_type
!=
'SentencePieceT
okenizer
'
:
assert
args
.
vocab_file
is
not
None
assert
args
.
vocab_file
is
not
None
# Select and instantiate the tokenizer.
if
args
.
tokenizer_type
==
'BertWordPieceLowerCase'
:
if
args
.
tokenizer_type
==
'BertWordPieceLowerCase'
:
tokenizer
=
_BertWordPieceTokenizer
(
vocab_file
=
args
.
vocab_file
,
tokenizer
=
_BertWordPieceTokenizer
(
vocab_file
=
args
.
vocab_file
,
lower_case
=
True
,
lower_case
=
True
,
...
...
tools/preprocess_data_partitions.py
View file @
84a43b13
...
@@ -174,6 +174,7 @@ class Partition(object):
...
@@ -174,6 +174,7 @@ class Partition(object):
self
.
print_processing_stats
(
i
,
proc_start
,
total_bytes_processed
)
self
.
print_processing_stats
(
i
,
proc_start
,
total_bytes_processed
)
fin
.
close
()
fin
.
close
()
builders
[
key
].
finalize
(
output_idx_files
[
key
])
def
get_args
():
def
get_args
():
...
@@ -219,8 +220,7 @@ def get_args():
...
@@ -219,8 +220,7 @@ def get_args():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
args
.
keep_empty
=
False
args
.
keep_empty
=
False
if
(
args
.
tokenizer_type
.
lower
().
startswith
(
'bert'
)
if
args
.
tokenizer_type
.
lower
().
startswith
(
'bert'
)
and
not
args
.
split_sentences
:
if
not
args
.
split_sentences
:
print
(
"Are you sure you don't want to split sentences?"
)
print
(
"Are you sure you don't want to split sentences?"
)
# some default/dummy values for the tokenizer
# some default/dummy values for the tokenizer
...
@@ -265,7 +265,11 @@ def main():
...
@@ -265,7 +265,11 @@ def main():
if
args
.
partitions
==
1
:
if
args
.
partitions
==
1
:
file_name
,
extension
=
os
.
path
.
splitext
(
args
.
input
)
file_name
,
extension
=
os
.
path
.
splitext
(
args
.
input
)
sentence_split_file
=
file_name
+
"_ss"
+
extension
sentence_split_file
=
file_name
+
"_ss"
+
extension
in_ss_out_names
.
append
((
args
.
input
,
sentence_split_file
,
args
.
output_prefix
))
file_names
=
{
'partition'
:
args
.
input
,
'sentence_split'
:
sentence_split_file
,
'output_prefix'
:
args
.
output_prefix
}
in_ss_out_names
.
append
(
file_names
)
else
:
else
:
in_file_names
=
glob
.
glob
(
args
.
input
)
in_file_names
=
glob
.
glob
(
args
.
input
)
...
@@ -358,7 +362,7 @@ def main():
...
@@ -358,7 +362,7 @@ def main():
full_partition_output_prefix
=
"{}_{}_{}"
.
format
(
parition_output_prefix
,
full_partition_output_prefix
=
"{}_{}_{}"
.
format
(
parition_output_prefix
,
key
,
level
)
key
,
level
)
builders
[
key
].
merge_file_
(
full_partition_output_prefix
)
builders
[
key
].
merge_file_
(
full_partition_output_prefix
)
builder
[
key
].
finalize
(
output_idx_files
[
key
])
builder
s
[
key
].
finalize
(
output_idx_files
[
key
])
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
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