TypeError: Descriptors cannot not be created directly 解决方法

  File "./tools/train.py", line 245, in 
    main()
  File "./tools/train.py", line 234, in main
    train_model(
  File "/opt/data/private/mmdetection3d/mmdet3d/apis/train.py", line 64, in train_model
    train_detector(
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/mmdet/apis/train.py", line 208, in train_detector
    runner.run(data_loaders, cfg.workflow)
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 108, in run
    self.call_hook('before_run')
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/mmcv/runner/base_runner.py", line 309, in call_hook
    getattr(hook, fn_name)(self)
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/mmcv/runner/dist_utils.py", line 129, in wrapper
    return func(*args, **kwargs)
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/mmcv/runner/hooks/logger/tensorboard.py", line 47, in before_run
    from torch.utils.tensorboard import SummaryWriter
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/torch/utils/tensorboard/__init__.py", line 13, in 
    from .writer import FileWriter, SummaryWriter  # noqa: F401
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py", line 9, in 
    from tensorboard.compat.proto.event_pb2 import SessionLog
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/tensorboard/compat/proto/event_pb2.py", line 17, in 
    from tensorboard.compat.proto import summary_pb2 as tensorboard_dot_compat_dot_proto_dot_summary__pb2
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/tensorboard/compat/proto/summary_pb2.py", line 17, in 
    from tensorboard.compat.proto import tensor_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__pb2
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/tensorboard/compat/proto/tensor_pb2.py", line 16, in 
    from tensorboard.compat.proto import resource_handle_pb2 as tensorboard_dot_compat_dot_proto_dot_resource__handle__pb2
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/tensorboard/compat/proto/resource_handle_pb2.py", line 16, in 
    from tensorboard.compat.proto import tensor_shape_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/tensorboard/compat/proto/tensor_shape_pb2.py", line 36, in 
    _descriptor.FieldDescriptor(
  File "/home/miniconda3/envs/mm/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 560, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

 按照提示重装protobuf,例如:

pip install protobuf==3.20.1

你可能感兴趣的:(教程,深度学习,pytorch,python)