Stop the engine from supplying a model id the remover must reject

InvisibleEngine substituted DEFAULT_MODEL_ID whenever model_id was None. When
b0ca205 tightened the remover's fixed-stack check from `not in {None,
DEFAULT_MODEL_ID}` to `is not None`, that substitution turned every single
InvisibleEngine construction into a ValueError - including the deployed Modal
worker's setup(), which is how it was found.

The library suite missed it because these two are tested from opposite sides:
every remover test builds WatermarkRemover directly with model_id unset, and
every engine test mocks the remover away. Nothing exercised the seam between
them. TestEngineDoesNotFabricateAModelId now does, without a GPU.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Victor Kuznetsov
2026-08-03 13:24:53 -07:00
co-authored by Claude Opus 5
parent 691f5d88c2
commit 1a77e24b99
2 changed files with 33 additions and 3 deletions
+4 -3
View File
@@ -121,10 +121,11 @@ class InvisibleEngine:
from remove_ai_watermarks._internal.watermark_remover import WatermarkRemover
effective_model = model_id or self.DEFAULT_MODEL_ID
# Pass model_id through untouched. Substituting DEFAULT_MODEL_ID for None here
# meant the engine always supplied a model the remover is required to reject,
# so EVERY construction raised once that check tightened to "is not None".
self._remover = WatermarkRemover(
model_id=effective_model,
model_id=model_id,
device=device,
progress_callback=progress_callback,
hf_token=hf_token,