Skip to content

Commit daef82d

Browse files
authored
[Build] deduplicate data_feed Python proto generation (#78718)
1 parent 30baea4 commit daef82d

2 files changed

Lines changed: 2 additions & 13 deletions

File tree

paddle/fluid/framework/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ cc_library(
334334

335335
if(WITH_PYTHON)
336336
py_proto_compile(framework_py_proto SRCS framework.proto data_feed.proto)
337-
py_proto_compile(trainer_py_proto SRCS trainer_desc.proto data_feed.proto)
337+
py_proto_compile(trainer_py_proto SRCS trainer_desc.proto)
338338
py_proto_compile(distributed_strategy_py_proto SRCS
339339
distributed_strategy.proto)
340340
py_proto_compile(pass_desc_py_proto SRCS pass_desc.proto)

python/paddle/base/trainer_desc.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414
"""Definition of trainers."""
1515

16-
import os
17-
import sys
18-
1916
__all__ = []
2017

2118

@@ -31,15 +28,7 @@ def __init__(self):
3128
with open(proto_file, 'r') as f:
3229
text_format.Parse(f.read(), self.proto_desc)
3330
'''
34-
# Workaround for relative import in protobuf under python3
35-
# TODO: should be fixed
36-
cur_path = os.path.dirname(__file__)
37-
if cur_path not in sys.path:
38-
sys.path.append(cur_path)
39-
if cur_path + "/proto" not in sys.path:
40-
sys.path.append(cur_path + "/proto")
41-
42-
from proto import trainer_desc_pb2
31+
from .proto import trainer_desc_pb2
4332

4433
self.proto_desc = trainer_desc_pb2.TrainerDesc()
4534
import multiprocessing as mp

0 commit comments

Comments
 (0)