transformers
ad333d48 - [Qwen2.5-VL] Fix torch.finfo() TypeError for integer attention_mask_tensor (#39333)

Commit
203 days ago
[Qwen2.5-VL] Fix torch.finfo() TypeError for integer attention_mask_tensor (#39333) * Update modeling_qwen2_5_vl.py ### 🐛 Bug Description When using Unsloth’s Qwen2.5-VL vision models (both 3B and 7B) with the latest HuggingFace Transformers (commit: 520b9dcb42cef21662c304583368ff6645116a45), the model crashes due to a type mismatch in the attention mask handling. --- ### 🔥 Error Traceback * Fix dtype compatibility in attention mask processing Replace hardcoded torch.finfo() usage with dtype-aware function selection to handle both integer and floating-point attention mask tensors. Technical Details: Problem: Line 1292 assumes floating-point dtype for attention_mask_tensor Solution: Add dtype check to use torch.iinfo() for integer types and torch.finfo() for float types Files Modified: transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py * Update modeling_qwen2_5_vl.py * Update modeling_qwen2_5_vl.py * Fix: Cast to float before applying torch.finfo * # Fix: Use appropriate function based on dtype * Update modular_qwen2_5_vl.py * Fix: Cast to float before applying torch.finfo * Fix: Use appropriate function based on dtype * Fix: Use appropriate function based on dtype * Updatet modeling_glm4v.py * Only apply conversion for floating point tensors (inverted masks) * corrected the format issue reformatted modeling_glm4v.py All done! ✨ 🍰 ✨ 1 file reformatted * Fix: Cast to float before applying torch.finfo Corrected the format issue * Fix torch.finfo() for integer attention mask #39333 * Run make fix-copies and make style for CI compliance - Updated dependency versions table - Fixed code formatting and style issues - Sorted auto mappings - Updated documentation TOC * Fix torch.finfo() TypeError for Fix torch.finfo() TypeError for integer attention_mask_tensor #39333 * Fix torch.finfo() TypeError for integer
Author
Parents
Loading