Skip to content

Commit 880f52b

Browse files
authored
Medcat conversion model name hotfix (#122)
* Avoid mid-name .zip format on model conversion * Set old model name even if loading from folder
1 parent e8b19bc commit 880f52b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

medcat-v2/medcat/utils/legacy/conversion_all.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ def __init__(self, medcat1_model_pack_path: str,
3131
ser_type: AvailableSerialisers = AvailableSerialisers.dill):
3232
if medcat1_model_pack_path.endswith(".zip"):
3333
folder_path = medcat1_model_pack_path[:-4]
34-
self.old_model_name = os.path.split(medcat1_model_pack_path)[1]
34+
self.old_model_name = os.path.split(
35+
medcat1_model_pack_path)[1].rsplit(".zip", 1)[0]
3536
unpack(medcat1_model_pack_path, folder_path)
3637
medcat1_model_pack_path = folder_path
38+
else:
39+
self.old_model_name = os.path.split(medcat1_model_pack_path)[1]
3740
if not os.path.isdir(medcat1_model_pack_path):
3841
raise ValueError(
3942
"Provided model path is not a directory: "

0 commit comments

Comments
 (0)