Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion medcat-v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,21 @@ Original paper for v1 on [arXiv](https://arxiv.org/abs/2010.01165).
As MedCAT v2 is still in early release, we do not currently have any models publically available.
You can still use models for v1, however (see the [README](https://github.com/CogStack/cogstack-nlp/blob/main/medcat-v2/README.md) there).

If you wish you can also convert the v1 models into the v2 format (see tutorial (TODO + link)).
If you wish you can also convert the v1 models into the v2 format (see [tutorial](https://github.com/CogStack/cogstack-nlp/blob/main/medcat-v2-tutorials/notebooks/introductory/migration/1._Migrate_v1_model_to_v2.ipynb)).

```python
from medcat.utils.legacy import legacy_converter
from medcat.storage.serialisers import AvailableSerialisers
old_model = '<path to old v1 model>'
new_model_dir = '<dir to place new model in>'
legacy_converter.do_conversion(old_model_path, new_model_dir, AvailableSerialisers.dill)
```
OR
```bash
model_path = "models/medcat1_model_pack.zip"
new_model_folder = "models" # file in this folder
! python -m medcat.utils.legacy.legacy_converter $model_path $new_model_folder --verbose
```

## News
- **MedCAT 2.0.0** was released 18. August 2025.
Expand Down
2 changes: 2 additions & 0 deletions medcat-v2/medcat/utils/legacy/conversion_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(self, medcat1_model_pack_path: str,
ser_type: AvailableSerialisers = AvailableSerialisers.dill):
if medcat1_model_pack_path.endswith(".zip"):
folder_path = medcat1_model_pack_path[:-4]
self.old_model_name = os.path.split(medcat1_model_pack_path)[1]
unpack(medcat1_model_pack_path, folder_path)
medcat1_model_pack_path = folder_path
if not os.path.isdir(medcat1_model_pack_path):
Expand Down Expand Up @@ -147,6 +148,7 @@ def convert(self) -> CAT:
logger.info("Saving converted model to '%s'",
self.new_model_folder)
cat.save_model_pack(self.new_model_folder,
pack_name=self.old_model_name + 'v2',
serialiser_type=self.ser_type)
return cat

Expand Down
Loading