MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / _write_string

Method _write_string

python/ctranslate2/specs/model_spec.py:394–397  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

392 with open(path, "wb") as model:
393
394 def _write_string(string):
395 model.write(struct.pack("H", len(string) + 1))
396 model.write(string.encode("utf-8"))
397 model.write(struct.pack("B", 0))
398
399 model.write(struct.pack("I", CURRENT_BINARY_VERSION))
400 _write_string(self.name)

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected