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
chenpangpang
transformers
Commits
8a861048
"vscode:/vscode.git/clone" did not exist on "013bdc6d65fe4fda7e7d0b829140fe994c0e68ce"
Commit
8a861048
authored
Mar 21, 2019
by
Matthew Carrigan
Browse files
Fixed up the notes on a possible future low-memory path
parent
a8a577ba
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
examples/lm_finetuning/finetune_on_pregenerated.py
examples/lm_finetuning/finetune_on_pregenerated.py
+1
-1
examples/lm_finetuning/pregenerate_training_data.py
examples/lm_finetuning/pregenerate_training_data.py
+2
-2
No files found.
examples/lm_finetuning/finetune_on_pregenerated.py
View file @
8a861048
...
...
@@ -54,7 +54,7 @@ def convert_example_to_features(example, tokenizer, max_seq_length):
class
PregeneratedDataset
(
Dataset
):
def
__init__
(
self
,
training_path
,
epoch
,
tokenizer
,
num_data_epochs
):
# TODO Add an option to memmap
and shuffle
the training data if needed (see note in pregenerate_training_data)
# TODO Add an option to memmap the training data if needed (see note in pregenerate_training_data)
self
.
vocab
=
tokenizer
.
vocab
self
.
tokenizer
=
tokenizer
self
.
epoch
=
epoch
...
...
examples/lm_finetuning/pregenerate_training_data.py
View file @
8a861048
...
...
@@ -220,8 +220,8 @@ def main():
# In this path documents would be stored in a shelf after being tokenized, and multiple processes would convert
# those docs into training examples that would be written out on the fly. This would avoid the need to keep
# the whole training set in memory and would speed up dataset creation at the cost of code complexity.
# In addition, the finetuning script would need to be modified
to store the training epochs as memmaped arrays,
#
and to shuffle them by importing to the rows of the array in a random order
.
# In addition, the finetuning script would need to be modified
#
to store the training epochs as memmapped arrays
.
tokenizer
=
BertTokenizer
.
from_pretrained
(
args
.
bert_model
,
do_lower_case
=
args
.
do_lower_case
)
vocab_list
=
list
(
tokenizer
.
vocab
.
keys
())
...
...
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