Skip to content

Commit 877e481

Browse files
fineguyThe TensorFlow Datasets Authors
authored andcommitted
Update proto files.
PiperOrigin-RevId: 523948721
1 parent e144a8b commit 877e481

File tree

8 files changed

+242
-3373
lines changed

8 files changed

+242
-3373
lines changed

tensorflow_datasets/core/proto/dataset_info_generated_pb2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
DESCRIPTOR, 'dataset_info_pb2', globals()
9595
)
9696
if _descriptor._USE_C_DESCRIPTORS == False:
97+
9798
DESCRIPTOR._options = None
9899
DESCRIPTOR._serialized_options = b'\370\001\001'
99100
_SUPERVISEDKEYS_DICT_DICTENTRY._options = None

tensorflow_datasets/core/proto/feature_generated_pb2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
8282
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'feature_pb2', globals())
8383
if _descriptor._USE_C_DESCRIPTORS == False:
84+
8485
DESCRIPTOR._options = None
8586
DESCRIPTOR._serialized_options = b'\370\001\001'
8687
_FEATURESDICT_FEATURESENTRY._options = None

tensorflow_datasets/core/proto/generate_py_proto.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
set -e # Fail on errors
77

88
# Ensure we have the desired protoc version.
9-
MIN_VERSION="libprotoc 3.11.2"
9+
MIN_VERSION="libprotoc 3.20.0"
1010
CURR_VERSION="$(protoc --version)"
1111
if ["$(printf '%s\n' "$MIN_VERSION" "$CURR_VERSION" | sort -V | head -n1)" != "$MIN_VERSION"]; then
12-
echo 'Please use version 3.11.2 or above.'
12+
echo 'Please use version 3.20.0 or above.'
1313
echo 'Please run install_protoc.sh to install it.'
1414
exit
1515
else
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
This is the directory with 'proto' files that are used by the datasets.
22

3+
## Protoc compiler
34
Proto files have to be compiled with protoc compiler -
4-
for installation instructions, please see core/proto/install_protoc.sh
5+
for installation instructions, please see `core/proto/install_protoc.sh`
6+
7+
## Proto generation
8+
- `tf_example.proto` and `tf_feature.proto` can be generated by running `build_tf_proto.py`;
9+
- `waymo_dataset.proto` can be generated by manually running protoc compiler.
510

611
Please always add both the original .proto and the compiled python version.

tensorflow_datasets/proto/build_tf_proto.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ def main(_) -> None:
121121

122122
# Launch protoc
123123
subprocess.run(
124-
['protoc', os.fspath(tfds_proto_path), '--python_out=.'],
124+
[
125+
'protoc',
126+
os.fspath(tfds_proto_path),
127+
f'--proto_path={PATH_TO_TFDS.parent}',
128+
f'--python_out={PATH_TO_TFDS.parent}',
129+
],
125130
check=True,
126131
)
127132
name_before = PATH_TO_PROTO / f'tf_{proto_name.value}_pb2.py'

tensorflow_datasets/proto/tf_example_generated_pb2.py

Lines changed: 18 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
# -*- coding: utf-8 -*-
1919
# Generated by the protocol buffer compiler. DO NOT EDIT!
2020
# source: tensorflow_datasets/proto/tf_example.proto
21-
21+
"""Generated protocol buffer code."""
22+
from google.protobuf.internal import builder as _builder
2223
from google.protobuf import descriptor as _descriptor
23-
from google.protobuf import message as _message
24-
from google.protobuf import reflection as _reflection
24+
from google.protobuf import descriptor_pool as _descriptor_pool
2525
from google.protobuf import symbol_database as _symbol_database
2626
# @@protoc_insertion_point(imports)
2727

@@ -31,153 +31,22 @@
3131
from tensorflow_datasets.proto import tf_feature_generated_pb2 as tensorflow__datasets_dot_proto_dot_tf__feature__pb2
3232

3333

34-
DESCRIPTOR = _descriptor.FileDescriptor(
35-
name='tensorflow_datasets/proto/tf_example.proto',
36-
package='tensorflow_copy',
37-
syntax='proto3',
38-
serialized_options=b'\n\026org.tensorflow.exampleB\rExampleProtosP\001ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/example/example_protos_go_proto\370\001\001',
39-
serialized_pb=(
40-
b'\n*tensorflow_datasets/proto/tf_example.proto\x12\x0ftensorflow_copy\x1a*tensorflow_datasets/proto/tf_feature.proto"6\n\x07\x45xample\x12+\n\x08\x66\x65\x61tures\x18\x01'
41-
b' \x01(\x0b\x32\x19.tensorflow_copy.Features"s\n\x0fSequenceExample\x12*\n\x07\x63ontext\x18\x01'
42-
b' \x01(\x0b\x32\x19.tensorflow_copy.Features\x12\x34\n\rfeature_lists\x18\x02'
43-
b' \x01(\x0b\x32\x1d.tensorflow_copy.FeatureListsB\x81\x01\n\x16org.tensorflow.exampleB\rExampleProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/example/example_protos_go_proto\xf8\x01\x01\x62\x06proto3'
44-
),
45-
dependencies=[
46-
tensorflow__datasets_dot_proto_dot_tf__feature__pb2.DESCRIPTOR,
47-
],
48-
)
49-
50-
51-
_EXAMPLE = _descriptor.Descriptor(
52-
name='Example',
53-
full_name='tensorflow_copy.Example',
54-
filename=None,
55-
file=DESCRIPTOR,
56-
containing_type=None,
57-
fields=[
58-
_descriptor.FieldDescriptor(
59-
name='features',
60-
full_name='tensorflow_copy.Example.features',
61-
index=0,
62-
number=1,
63-
type=11,
64-
cpp_type=10,
65-
label=1,
66-
has_default_value=False,
67-
default_value=None,
68-
message_type=None,
69-
enum_type=None,
70-
containing_type=None,
71-
is_extension=False,
72-
extension_scope=None,
73-
serialized_options=None,
74-
file=DESCRIPTOR,
75-
),
76-
],
77-
extensions=[],
78-
nested_types=[],
79-
enum_types=[],
80-
serialized_options=None,
81-
is_extendable=False,
82-
syntax='proto3',
83-
extension_ranges=[],
84-
oneofs=[],
85-
serialized_start=107,
86-
serialized_end=161,
34+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
35+
b'\n*tensorflow_datasets/proto/tf_example.proto\x12\x0ftensorflow_copy\x1a*tensorflow_datasets/proto/tf_feature.proto"6\n\x07\x45xample\x12+\n\x08\x66\x65\x61tures\x18\x01'
36+
b' \x01(\x0b\x32\x19.tensorflow_copy.Features"s\n\x0fSequenceExample\x12*\n\x07\x63ontext\x18\x01'
37+
b' \x01(\x0b\x32\x19.tensorflow_copy.Features\x12\x34\n\rfeature_lists\x18\x02'
38+
b' \x01(\x0b\x32\x1d.tensorflow_copy.FeatureListsB\x81\x01\n\x16org.tensorflow.exampleB\rExampleProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/example/example_protos_go_proto\xf8\x01\x01\x62\x06proto3'
8739
)
8840

89-
90-
_SEQUENCEEXAMPLE = _descriptor.Descriptor(
91-
name='SequenceExample',
92-
full_name='tensorflow_copy.SequenceExample',
93-
filename=None,
94-
file=DESCRIPTOR,
95-
containing_type=None,
96-
fields=[
97-
_descriptor.FieldDescriptor(
98-
name='context',
99-
full_name='tensorflow_copy.SequenceExample.context',
100-
index=0,
101-
number=1,
102-
type=11,
103-
cpp_type=10,
104-
label=1,
105-
has_default_value=False,
106-
default_value=None,
107-
message_type=None,
108-
enum_type=None,
109-
containing_type=None,
110-
is_extension=False,
111-
extension_scope=None,
112-
serialized_options=None,
113-
file=DESCRIPTOR,
114-
),
115-
_descriptor.FieldDescriptor(
116-
name='feature_lists',
117-
full_name='tensorflow_copy.SequenceExample.feature_lists',
118-
index=1,
119-
number=2,
120-
type=11,
121-
cpp_type=10,
122-
label=1,
123-
has_default_value=False,
124-
default_value=None,
125-
message_type=None,
126-
enum_type=None,
127-
containing_type=None,
128-
is_extension=False,
129-
extension_scope=None,
130-
serialized_options=None,
131-
file=DESCRIPTOR,
132-
),
133-
],
134-
extensions=[],
135-
nested_types=[],
136-
enum_types=[],
137-
serialized_options=None,
138-
is_extendable=False,
139-
syntax='proto3',
140-
extension_ranges=[],
141-
oneofs=[],
142-
serialized_start=163,
143-
serialized_end=278,
144-
)
145-
146-
_EXAMPLE.fields_by_name['features'].message_type = (
147-
tensorflow__datasets_dot_proto_dot_tf__feature__pb2._FEATURES
148-
)
149-
_SEQUENCEEXAMPLE.fields_by_name['context'].message_type = (
150-
tensorflow__datasets_dot_proto_dot_tf__feature__pb2._FEATURES
41+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
42+
_builder.BuildTopDescriptorsAndMessages(
43+
DESCRIPTOR, 'tensorflow_datasets.proto.tf_example_pb2', globals()
15144
)
152-
_SEQUENCEEXAMPLE.fields_by_name['feature_lists'].message_type = (
153-
tensorflow__datasets_dot_proto_dot_tf__feature__pb2._FEATURELISTS
154-
)
155-
DESCRIPTOR.message_types_by_name['Example'] = _EXAMPLE
156-
DESCRIPTOR.message_types_by_name['SequenceExample'] = _SEQUENCEEXAMPLE
157-
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
158-
159-
Example = _reflection.GeneratedProtocolMessageType(
160-
'Example',
161-
(_message.Message,),
162-
{
163-
'DESCRIPTOR': _EXAMPLE,
164-
'__module__': 'tensorflow_datasets.proto.tf_example_pb2',
165-
# @@protoc_insertion_point(class_scope:tensorflow_copy.Example)
166-
},
167-
)
168-
_sym_db.RegisterMessage(Example)
169-
170-
SequenceExample = _reflection.GeneratedProtocolMessageType(
171-
'SequenceExample',
172-
(_message.Message,),
173-
{
174-
'DESCRIPTOR': _SEQUENCEEXAMPLE,
175-
'__module__': 'tensorflow_datasets.proto.tf_example_pb2',
176-
# @@protoc_insertion_point(class_scope:tensorflow_copy.SequenceExample)
177-
},
178-
)
179-
_sym_db.RegisterMessage(SequenceExample)
180-
181-
182-
DESCRIPTOR._options = None
45+
if _descriptor._USE_C_DESCRIPTORS == False:
46+
DESCRIPTOR._options = None
47+
DESCRIPTOR._serialized_options = b'\n\026org.tensorflow.exampleB\rExampleProtosP\001ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/example/example_protos_go_proto\370\001\001'
48+
_EXAMPLE._serialized_start = 107
49+
_EXAMPLE._serialized_end = 161
50+
_SEQUENCEEXAMPLE._serialized_start = 163
51+
_SEQUENCEEXAMPLE._serialized_end = 278
18352
# @@protoc_insertion_point(module_scope)

0 commit comments

Comments
 (0)