mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-07-12 06:39:31 +02:00
training convert: only add characters_org.txt if it exists
This commit is contained in:
parent
42a3751e63
commit
ef47f0ef09
1 changed files with 6 additions and 5 deletions
|
|
@ -68,12 +68,13 @@ def convert_cli(rebuild, format_, in_, out):
|
||||||
ex.add_config(str(config_path))
|
ex.add_config(str(config_path))
|
||||||
# some models deviate between training and inference
|
# some models deviate between training and inference
|
||||||
ex.add_config(inference=True)
|
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"
|
characters_txt_file = model_path / "characters_org.txt"
|
||||||
with open(characters_txt_file, "r") as voc_file:
|
if characters_txt_file.exists():
|
||||||
voc = json.load(voc_file)
|
with open(characters_txt_file, "r") as voc_file:
|
||||||
ex.add_config(characters_txt_file=characters_txt_file)
|
voc = json.load(voc_file)
|
||||||
ex.add_config(n_classes=len(voc) + 3)
|
ex.add_config(characters_txt_file=characters_txt_file)
|
||||||
|
ex.add_config(n_classes=len(voc) + 3)
|
||||||
# just retrieve final config (via pseudo-run)
|
# just retrieve final config (via pseudo-run)
|
||||||
ex.main(lambda: 0)
|
ex.main(lambda: 0)
|
||||||
config = ex.run(options={'--loglevel': 'ERROR'}).config
|
config = ex.run(options={'--loglevel': 'ERROR'}).config
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue