training convert: only add characters_org.txt if it exists

This commit is contained in:
Robert Sachunsky 2026-06-26 02:11:59 +02:00
parent 42a3751e63
commit ef47f0ef09

View file

@ -68,8 +68,9 @@ def convert_cli(rebuild, format_, in_, out):
ex.add_config(str(config_path))
# some models deviate between training and inference
ex.add_config(inference=True)
# make sure the local vocab file gets re-used
# OCR models: make sure the local vocab file gets re-used, if available
characters_txt_file = model_path / "characters_org.txt"
if characters_txt_file.exists():
with open(characters_txt_file, "r") as voc_file:
voc = json.load(voc_file)
ex.add_config(characters_txt_file=characters_txt_file)