Skip to content

Commit 3f0d9a9

Browse files
zoyahavtfx-copybara
authored andcommitted
Update TFT examples to get DatasetMetadata from the tft module instead of dataset_metadata.
PiperOrigin-RevId: 480875826
1 parent 862496f commit 3f0d9a9

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

examples/census_example_common.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import tensorflow.compat.v2 as tf
2323
import tensorflow_transform as tft
2424
import tensorflow_transform.beam as tft_beam
25-
from tensorflow_transform.tf_metadata import dataset_metadata
2625
from tfx_bsl.public.tfxio import RecordBatchToExamplesEncoder
2726
from tfx_bsl.public import tfxio
2827

@@ -64,8 +63,7 @@
6463
[(LABEL_KEY,
6564
tf.io.FixedLenFeature([], tf.string))])
6665

67-
_SCHEMA = dataset_metadata.DatasetMetadata.from_feature_spec(
68-
RAW_DATA_FEATURE_SPEC).schema
66+
_SCHEMA = tft.DatasetMetadata.from_feature_spec(RAW_DATA_FEATURE_SPEC).schema
6967

7068
# Constants used for training. Note that the number of instances will be
7169
# computed by tf.Transform in future versions, in which case it can be read from

examples/sentiment_example.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from tensorflow import estimator as tf_estimator
2525
import tensorflow_transform as tft
2626
import tensorflow_transform.beam as tft_beam
27-
from tensorflow_transform.tf_metadata import dataset_metadata
2827
from tfx_bsl.public import tfxio
2928

3029

@@ -43,8 +42,7 @@
4342
LABEL_KEY: tf.io.FixedLenFeature([], tf.int64)
4443
}
4544

46-
SCHEMA = dataset_metadata.DatasetMetadata.from_feature_spec(
47-
RAW_DATA_FEATURE_SPEC).schema
45+
SCHEMA = tft.DatasetMetadata.from_feature_spec(RAW_DATA_FEATURE_SPEC).schema
4846

4947
DELIMITERS = '.,!?() '
5048

0 commit comments

Comments
 (0)