Skip to content

Commit

Permalink
CU-8695hghww backwards compatibility workflow (CogStack#478)
Browse files Browse the repository at this point in the history
* 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
mart-r authored Nov 1, 2024
1 parent e924798 commit c0082ef
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
timeout 25m python -m unittest ${second_half_nl[@]}
- name: Regression
run: source tests/resources/regression/run_regression.sh
- name: Model backwards compatibility
run: source tests/resources/model_compatibility/check_backwards_compatibility.sh
- name: Get the latest release version
id: get_latest_release
uses: actions/github-script@v6
Expand Down
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"

0 comments on commit c0082ef

Please sign in to comment.