Fix the AttributeError: 'KimiVLForConditionalGeneration' object has no attribute '_supports_sdpa' issue after bumping to transformers==4.54.0 (#29)
Browse files- Fix the AttributeError: 'KimiVLForConditionalGeneration' object has no attribute '_supports_sdpa' issue after bumping to transformers==4.54.0 (b9478eca74c82bf4e1802ab4e820651e42883326)
Co-authored-by: He <[email protected]>
- modeling_kimi_vl.py +1 -8
modeling_kimi_vl.py
CHANGED
|
@@ -2406,6 +2406,7 @@ class KimiVLPreTrainedModel(PreTrainedModel, GenerationMixin):
|
|
| 2406 |
_no_split_modules = ["MoonVitEncoderLayer", "DeepseekV3DecoderLayer"]
|
| 2407 |
_skip_keys_device_placement = "past_key_values"
|
| 2408 |
_supports_flash_attn_2 = True
|
|
|
|
| 2409 |
|
| 2410 |
def _init_weights(self, module):
|
| 2411 |
# important: this ported version of Llava isn't meant for training from scratch - only
|
|
@@ -2429,14 +2430,6 @@ class KimiVLPreTrainedModel(PreTrainedModel, GenerationMixin):
|
|
| 2429 |
if module.padding_idx is not None:
|
| 2430 |
module.weight.data[module.padding_idx].zero_()
|
| 2431 |
|
| 2432 |
-
@property
|
| 2433 |
-
def _supports_sdpa(self):
|
| 2434 |
-
"""
|
| 2435 |
-
Retrieve language_model's attribute to check whether the model supports
|
| 2436 |
-
SDPA or not.
|
| 2437 |
-
"""
|
| 2438 |
-
return self.language_model._supports_sdpa
|
| 2439 |
-
|
| 2440 |
|
| 2441 |
class KimiVLForConditionalGeneration(KimiVLPreTrainedModel, GenerationMixin):
|
| 2442 |
|
|
|
|
| 2406 |
_no_split_modules = ["MoonVitEncoderLayer", "DeepseekV3DecoderLayer"]
|
| 2407 |
_skip_keys_device_placement = "past_key_values"
|
| 2408 |
_supports_flash_attn_2 = True
|
| 2409 |
+
_supports_sdpa = False
|
| 2410 |
|
| 2411 |
def _init_weights(self, module):
|
| 2412 |
# important: this ported version of Llava isn't meant for training from scratch - only
|
|
|
|
| 2430 |
if module.padding_idx is not None:
|
| 2431 |
module.weight.data[module.padding_idx].zero_()
|
| 2432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2433 |
|
| 2434 |
class KimiVLForConditionalGeneration(KimiVLPreTrainedModel, GenerationMixin):
|
| 2435 |
|