I am writing a tool to dump our dedicated ML model from flatbuffers binary into human readable text format, is there any helper like text_format for protobuf?
Asked
Active
Viewed 1,464 times
3
-
Not sure why this got downvoted to -1, it is a perfectly reasonable question. I upvoted it. – Aardappel Oct 29 '19 at 14:42
1 Answers
1
There's currently no way to do that directly in Python, you'll need to invoke the command-line flatc
tool to do so, e.g. flatc --json myschema.fbs mybinary.bin
results in mybinary.json
.
If necessary, it would be possible to compile the C++ json generator (and parser) into something that can be called from Python (through C), but that requires knowledge on how to create such extension libraries for Python.

Aardappel
- 5,559
- 1
- 19
- 22
-
Thanks Aardappel. In practice I found we need to add a `--` between shema file and binary file, it may also require a `--raw_binary` argument if there are not `file_identifier`. For those who has a similar requirment, please refer to [here](https://google.github.io/flatbuffers/flatbuffers_guide_using_schema_compiler.html) for details. – zmyzhou Oct 30 '19 at 09:43
-