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
07f0bb69
Unverified
Commit
07f0bb69
authored
Apr 09, 2021
by
Stas Bekman
Committed by
GitHub
Apr 09, 2021
Browse files
[examples run_clm] fix _LazyModule hasher error (#11168)
* fix _LazyModule hasher error * reword
parent
c161dd56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
examples/language-modeling/run_clm.py
examples/language-modeling/run_clm.py
+3
-1
No files found.
examples/language-modeling/run_clm.py
View file @
07f0bb69
...
@@ -317,8 +317,10 @@ def main():
...
@@ -317,8 +317,10 @@ def main():
column_names
=
datasets
[
"validation"
].
column_names
column_names
=
datasets
[
"validation"
].
column_names
text_column_name
=
"text"
if
"text"
in
column_names
else
column_names
[
0
]
text_column_name
=
"text"
if
"text"
in
column_names
else
column_names
[
0
]
# since this will be pickled to avoid _LazyModule error in Hasher force logger loading before tokenize_function
tok_logger
=
transformers
.
utils
.
logging
.
get_logger
(
"transformers.tokenization_utils_base"
)
def
tokenize_function
(
examples
):
def
tokenize_function
(
examples
):
tok_logger
=
transformers
.
utils
.
logging
.
get_logger
(
"transformers.tokenization_utils_base"
)
with
CaptureLogger
(
tok_logger
)
as
cl
:
with
CaptureLogger
(
tok_logger
)
as
cl
:
output
=
tokenizer
(
examples
[
text_column_name
])
output
=
tokenizer
(
examples
[
text_column_name
])
# clm input could be much much longer than block_size
# clm input could be much much longer than block_size
...
...
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