Closed vmajor closed 1 year ago
It looks like your project is importing two different sentencepiece_model_pb2.py
files. One lives at /home/******/anaconda3/envs/guidance/lib/python3.10/site-packages/transformers/utils/sentencepiece_model_pb2.py
. There is probably another one somewhere in your tree that is getting imported from a different directory.
@haberman are there any recommendations on how to handle two sets of Protobufs which both contain files with the same name? E.g. consuming two APIs defined by Protobufs which both have a types.proto
or something similarly generic
Every .proto
file should have a unique path name. eg. Protobuf itself ships a proto called google/protobuf/timestamp.proto
. If another project also wants a timestamp proto, it should have a different directory name, like fooproject/timestamp.proto
.
These then map to Python package names, eg
import google.protobuf.timestamp_pb2
import fooproject.timestamp_pb2
Imports in .proto
files should always use the full file name:
import "google/protobuf/timestamp.proto";
import "fooproject/timestamp.proto";
And invocations of proto
should always be relative to the base directory, eg.
$ protoc --python_out=. google/protobuf/timestamp.proto
anyone found any solution of it?
What version of protobuf and what language are you using? Version: protobuf-4.23.1, protobuf-4.23.1 no binary, protobuf-3.2.0, protobuf-4.21.9, protobuf-4.21.11
What operating system (Linux, Windows, ...) and version?
5.15.68.1-microsoft-standard-WSL2+ #2 SMP
What runtime / compiler are you using (e.g., python version or gcc version)
Python 3.10.9
What did you do?
What did you expect to see
Not the traceback.
What did you see instead?