Fix AutoProcessor.from_pretrained silently dropping hub kwargs (#44710)
* Fix AutoProcessor.from_pretrained silently dropping hub kwargs
The previous code used inspect.signature(cached_file).parameters to
filter kwargs before passing them to cached_file(). However, since
cached_file() is defined with **kwargs in its signature, only
'path_or_repo_id', 'filename', and 'kwargs' were visible as parameter
names. This meant user-supplied hub kwargs like force_download,
cache_dir, token, revision, etc. were silently dropped and never
forwarded.
Replace the inspect.signature approach with an explicit tuple of known
hub parameter names that cached_file actually accepts (via cached_files).
This matches how other auto classes like AutoTokenizer handle the same
situation.
Fixes #44704
Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
* narrow it a bit
---------
Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>