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
25533638
Unverified
Commit
25533638
authored
Jan 20, 2023
by
Steven Liu
Committed by
GitHub
Jan 20, 2023
Browse files
Fix code example in training tutorial (#21201)
change text to sentence
parent
7419d807
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
docs/source/en/training.mdx
docs/source/en/training.mdx
+1
-1
No files found.
docs/source/en/training.mdx
View file @
25533638
...
@@ -184,7 +184,7 @@ so we can just convert that directly to a NumPy array without tokenization!
...
@@ -184,7 +184,7 @@ so we can just convert that directly to a NumPy array without tokenization!
from transformers import AutoTokenizer
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
tokenized_data = tokenizer(dataset["
text
"], return_tensors="np", padding=True)
tokenized_data = tokenizer(dataset["
sentence
"], return_tensors="np", padding=True)
# Tokenizer returns a BatchEncoding, but we convert that to a dict for Keras
# Tokenizer returns a BatchEncoding, but we convert that to a dict for Keras
tokenized_data = dict(tokenized_data)
tokenized_data = dict(tokenized_data)
...
...
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