transformers
5c1df12f - Fix KeyError in _is_package_available for packages with dotted names (#42050)

Commit
138 days ago
Fix KeyError in _is_package_available for packages with dotted names (#42050) Fixes #41981 When checking for packages with dotted names like 'optimum.quanto', the function was crashing with KeyError because these packages aren't always in PACKAGE_DISTRIBUTION_MAPPING (it might only have 'optimum' as a key, not 'optimum.quanto'). The function already had fallback logic to handle cases where package metadata can't be found - it tries to import the package directly. But the exception handler only caught PackageNotFoundError, not KeyError. This adds KeyError to the exception handler so the fallback works for both cases. Co-authored-by: Yashwant Bezawada <yashwantbezawada@gmail.com>
Parents
Loading