Skip to content

bug(medcat-trainer): CU-869ctq789 Fix saving model packs#402

Merged
mart-r merged 8 commits intomainfrom
bug/medcat-trainer/CU-869ctq789-fix-saving-model-packs
Apr 10, 2026
Merged

bug(medcat-trainer): CU-869ctq789 Fix saving model packs#402
mart-r merged 8 commits intomainfrom
bug/medcat-trainer/CU-869ctq789-fix-saving-model-packs

Conversation

@mart-r
Copy link
Copy Markdown
Collaborator

@mart-r mart-r commented Apr 7, 2026

Hopefully this fixes:

https://discourse.cogstack.org/t/unable-to-save-model-from-trainer/378

The idea is to allow model pack based projects to overwrite their model packs as the CDB based ones were designed to.
Though notably without the overwrite=True option they, too, would probably have failed.

So this PR does the following:

  • Creates a separate function to do the model pack overwriting if/when required
  • Moves the old model pack to a temporary folder
    • Because the CAT.save_model_pack method doesn't allow (or delegate the allowing of) overwriting existing ifles
    • And if we just removed the previous file(s) I'd be afraid of leaving a state with a model pack path that refers to nothing
    • If all goes well, the copy is destroyed after
    • If something fails, attempt to move the old one back to its original location

Copy link
Copy Markdown
Collaborator

@alhendrickson alhendrickson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Copy link
Copy Markdown
Collaborator

@alhendrickson alhendrickson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers - lgtm

@mart-r mart-r merged commit 60f6ba7 into main Apr 10, 2026
10 checks passed
@mart-r mart-r deleted the bug/medcat-trainer/CU-869ctq789-fix-saving-model-packs branch April 10, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants