transformers
2da00a3c - [Bugfix] Remove incorrect torchvision requirement from PIL backend image processors (#45045)

Commit
2 hours ago
[Bugfix] Remove incorrect torchvision requirement from PIL backend image processors (#45045) * [Bugfix] Remove incorrect torchvision requirement from PIL backend image processors PR #45029 added @requires(backends=("vision", "torch", "torchvision")) to 67 PIL backend image_processing_pil_*.py files. This causes PIL backend classes to become dummy objects when torchvision is not installed, making AutoImageProcessor unable to find any working processor. Fix: set @requires to ("vision",) for files that only need PIL, and ("vision", "torch") for files that also use torch directly. Also fix 5 modular source files so make fix-repo preserves the correct backends. Fixes #45042 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [Bugfix] Remove redundant @requires(backends=("vision",)) from PIL backends Per reviewer feedback: the vision-only @requires decorator is redundant for PIL backend classes since PilBackend base class already handles this. - Remove @requires(backends=("vision",)) from 43 PIL backend files - Remove unused `requires` import from 38 files (Category A) - Keep @requires(backends=("vision", "torch")) on method-level decorators (Category B: 5 files) * update * remove torch when its not necessary * remove if typechecking * fix import shinanigans * marvellous that's how we protect torch :) * beit is torchvisionbackend * more import cleanup * fiixup * fix-repo * update * style * fixes * up * more * fix repo * up * update * fix imports * style * fix check copies * arf * converter up * fix? * fix copies * fix for func * style * ignore * type --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Arthur <arthur.zucker@gmail.com>
Author
Parents
Loading