Skip to content

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

Open
mart-r wants to merge 5 commits intomainfrom
bug/medcat-trainer/CU-869ctq789-fix-saving-model-packs
Open

bug(medcat-trainer): CU-869ctq789 Fix saving model packs#402
mart-r wants to merge 5 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

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.

1 participant