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
9ad83059
Unverified
Commit
9ad83059
authored
Oct 09, 2020
by
Julien Plu
Committed by
GitHub
Oct 09, 2020
Browse files
Fix dataset cardinality (#7678)
* Fix test * Fix cardinality issue * Fix test
parent
a1ac0828
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
examples/text-classification/run_tf_text_classification.py
examples/text-classification/run_tf_text_classification.py
+9
-0
No files found.
examples/text-classification/run_tf_text_classification.py
View file @
9ad83059
...
...
@@ -96,6 +96,9 @@ def get_tfds(
else
None
)
if
train_ds
is
not
None
:
train_ds
=
train_ds
.
apply
(
tf
.
data
.
experimental
.
assert_cardinality
(
len
(
ds
[
datasets
.
Split
.
TRAIN
])))
val_ds
=
(
tf
.
data
.
Dataset
.
from_generator
(
gen_val
,
...
...
@@ -106,6 +109,9 @@ def get_tfds(
else
None
)
if
val_ds
is
not
None
:
val_ds
=
val_ds
.
apply
(
tf
.
data
.
experimental
.
assert_cardinality
(
len
(
ds
[
datasets
.
Split
.
VALIDATION
])))
test_ds
=
(
tf
.
data
.
Dataset
.
from_generator
(
gen_test
,
...
...
@@ -116,6 +122,9 @@ def get_tfds(
else
None
)
if
test_ds
is
not
None
:
test_ds
=
test_ds
.
apply
(
tf
.
data
.
experimental
.
assert_cardinality
(
len
(
ds
[
datasets
.
Split
.
TEST
])))
return
train_ds
,
val_ds
,
test_ds
,
label2id
...
...
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