litert-lm-builder-nightly 0.15.0.dev20260709
“Python tools for building and inspecting LiteRT-LM file formats”
Parses Python protobuf messageSerializes Python protobuf message
SHA-25601990c0f8022226992ccda4379c4fc78cc0fc65dac313db365cef587a6bc4490
MaleculeO(As)H(Db)
Evidence
⋯6 lines
52
53import flatbuffers
54from google.protobuf import message
55from google.protobuf import text_format
56# TODO(b/514828153): Migrate to standard library tomllib when Python 3.1 …
474:21… m_core.open_file(llm_metadata_path, "r") as f:
475 data = text_format.Parse(
476 f.read(), llm_metadata_pb2.LlmMetadata()
477 ).SerializeToString()
⋯4 lines
⋯4 lines
676 ), "HF tokenizer file must be either .json or .zlib format."
677 uncompressed_size = len(content)
678 compressed_content = zlib.compress(content)
679 stream.write(uncompressed_size.to_bytes(8, "little"))
680 stream.write(compressed_content)
681
682 sectio …
808:10… set = 0
809 while num_bytes > 0 and (
810 bytes_sent := os.sendfile(
811 out_fd, in_fd, offset=offset, count=num_bytes
812 )
813 ):
814 offset += bytes_sent
815 num_byte …
853:11… ent = f.read()
854 msg = llm_metadata_pb2.LlmMetadata()
855 msg.ParseFromString(content)
856 if msg.IsInitialized():
857 return True
858 except message.DecodeError:
859 # This is expected if the file is …
No evidence locations were recorded for this file. Raw result