Skip to content

Commit 1b684e8

Browse files
committed
fix(docker): correct trust_remote_code patch in PIGuard export script
The previous sed patch inserted trust_remote_code=True before the positional model-id argument, causing a SyntaxError. Patch the closing 'revision=MODEL_REVISION)' instead, and suppress the pip root-user/upgrade warnings.
1 parent f1cd4bf commit 1b684e8

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

docker/piguard/download-model.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ docker run --rm \
6060
# does not pass trust_remote_code=True, so we patch it to avoid the interactive
6161
# y/N prompt that would hang in a non-TTY container.
6262
echo '==> Patching export script to allow custom HF modeling code...'
63-
sed -i 's/AutoTokenizer.from_pretrained(MODEL_ID, revision=MODEL_REVISION)/AutoTokenizer.from_pretrained(MODEL_ID, revision=MODEL_REVISION, trust_remote_code=True)/' scripts/export_onnx.py
64-
sed -i 's/AutoModelForSequenceClassification.from_pretrained(/AutoModelForSequenceClassification.from_pretrained(trust_remote_code=True, /' scripts/export_onnx.py
63+
sed -i 's/revision=MODEL_REVISION)/revision=MODEL_REVISION, trust_remote_code=True)/g' scripts/export_onnx.py
6564
6665
echo '==> Installing Python export requirements (this may take a minute)...'
67-
pip install --no-cache-dir --quiet -r scripts/requirements.txt
66+
pip install --root-user-action=ignore --disable-pip-version-check --no-cache-dir --quiet -r scripts/requirements.txt
6867
6968
echo '==> Exporting PIGuard model from HuggingFace to ONNX (~735 MB, be patient)...'
7069
python -u scripts/export_onnx.py

0 commit comments

Comments
 (0)