forked from CogStack/MedCAT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CU-8695hghww backwards compatibility workflow (CogStack#478)
* CU-8695hghww: Add bash script to run backwards compatibility * CU-8695hghww: Rename backwards compatibility running bash script * CU-8695hghww: Add new step to workflow to run model backwards compatibility * CU-8695hghww: Fix model compatibility regression suite path * CU-8695hghww: Simplify creation and removal of fake model folder
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
tests/resources/model_compatibility/check_backwards_compatibility.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# CONSTANTs/ shouldn't change | ||
REGRESSION_MODULE="medcat.utils.regression.regression_checker" | ||
REGRESSION_OPTIONS="--strictness STRICTEST --require-fully-correct" | ||
|
||
# CHANGABLES | ||
# target models | ||
DL_LINK="https://cogstack-medcat-example-models.s3.eu-west-2.amazonaws.com/medcat-example-models/all_fake_medcat_models.zip" | ||
ZIP_FILE_NAME="all_fake_medcat_models.zip" | ||
# target regression set | ||
REGRESSION_TEST_SET="tests/resources/regression/testing/test_model_regresssion.yml" | ||
# folder to house models under test | ||
MODEL_FOLDER="fake_models" | ||
|
||
# START WORK | ||
|
||
echo "Downloading models" | ||
wget $DL_LINK | ||
# Create folder if it doesn't exit | ||
mkdir -p "$MODEL_FOLDER" | ||
echo "Uncompressing files" | ||
unzip $ZIP_FILE_NAME -d $MODEL_FOLDER | ||
echo "Cleaning up the overall zip" | ||
rm $ZIP_FILE_NAME | ||
for model_path in `ls $MODEL_FOLDER/*.zip`; do | ||
if [ -f "$model_path" ]; then | ||
echo "Processing $model_path" | ||
python -m $REGRESSION_MODULE \ | ||
"$model_path" \ | ||
$REGRESSION_TEST_SET \ | ||
$REGRESSION_OPTIONS | ||
# this is a sanity check - needst to run after so that the folder has been created | ||
grep "MedCAT Version" "${model_path%.*}/model_card.json" | ||
# clean up here so we don't leave both the .zip'ed model | ||
# and the folder so we don't fill the disk | ||
echo "Cleaning up at: ${model_path%.*}" | ||
rm -rf ${model_path%.*}* | ||
else | ||
echo "No files found matching the pattern: $file" | ||
fi | ||
done | ||
|
||
# Remove the fake model folder | ||
rm -r "$MODEL_FOLDER" |