Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
84b9579d
Unverified
Commit
84b9579d
authored
Oct 25, 2021
by
Matt
Committed by
GitHub
Oct 25, 2021
Browse files
Remove unneeded `to_tensor()` in TF inline example (#14140)
parent
1967c43e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
docs/source/training.rst
docs/source/training.rst
+2
-2
No files found.
docs/source/training.rst
View file @
84b9579d
...
@@ -240,11 +240,11 @@ Then we convert everything in big tensors and use the :obj:`tf.data.Dataset.from
...
@@ -240,11 +240,11 @@ Then we convert everything in big tensors and use the :obj:`tf.data.Dataset.from
..
code
-
block
::
python
..
code
-
block
::
python
train_features
=
{
x
:
tf_train_dataset
[
x
]
.
to_tensor
()
for
x
in
tokenizer
.
model_input_names
}
train_features
=
{
x
:
tf_train_dataset
[
x
]
for
x
in
tokenizer
.
model_input_names
}
train_tf_dataset
=
tf
.
data
.
Dataset
.
from_tensor_slices
((
train_features
,
tf_train_dataset
[
"label"
]))
train_tf_dataset
=
tf
.
data
.
Dataset
.
from_tensor_slices
((
train_features
,
tf_train_dataset
[
"label"
]))
train_tf_dataset
=
train_tf_dataset
.
shuffle
(
len
(
tf_train_dataset
)).
batch
(
8
)
train_tf_dataset
=
train_tf_dataset
.
shuffle
(
len
(
tf_train_dataset
)).
batch
(
8
)
eval_features
=
{
x
:
tf_eval_dataset
[
x
]
.
to_tensor
()
for
x
in
tokenizer
.
model_input_names
}
eval_features
=
{
x
:
tf_eval_dataset
[
x
]
for
x
in
tokenizer
.
model_input_names
}
eval_tf_dataset
=
tf
.
data
.
Dataset
.
from_tensor_slices
((
eval_features
,
tf_eval_dataset
[
"label"
]))
eval_tf_dataset
=
tf
.
data
.
Dataset
.
from_tensor_slices
((
eval_features
,
tf_eval_dataset
[
"label"
]))
eval_tf_dataset
=
eval_tf_dataset
.
batch
(
8
)
eval_tf_dataset
=
eval_tf_dataset
.
batch
(
8
)
...
...
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