Files
chflame163-ComfyUI_LayerSty…/py/local_groundingdino
Arthur R LongbottomandClaude Opus 4.6 2130085440 Fix GroundingDINO bertwarper for transformers 5.x + PyTorch 2.9+
transformers 5.x introduced two breaking changes that affect the
bundled GroundingDINO BertModelWarper:

1. `BertModel.get_head_mask()` was removed. Added a standalone
   `_get_head_mask()` fallback with a `hasattr` check so both
   transformers 4.x and 5.x work.

2. `BertModel.get_extended_attention_mask()` changed its 3rd
   positional argument from `device` to `dtype`. The old call-site
   passes a `torch.device`, which newer transformers interprets as
   `dtype=torch.device` → TypeError. Replaced with a standalone
   `_get_extended_attention_mask()` static method that also handles
   PyTorch 2.9's prohibition of `1.0 - bool_tensor` by explicitly
   casting to float32 first.

Fixes #140

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 10:55:47 -08:00
..
2024-12-05 17:11:26 +08:00
2024-12-05 17:11:26 +08:00