(incompatible_keys, adapter_name)
| 399 | |
| 400 | |
| 401 | def _maybe_warn_for_unhandled_keys(incompatible_keys, adapter_name): |
| 402 | warn_msg = "" |
| 403 | if incompatible_keys is not None: |
| 404 | # Check only for unexpected keys. |
| 405 | unexpected_keys = getattr(incompatible_keys, "unexpected_keys", None) |
| 406 | if unexpected_keys: |
| 407 | lora_unexpected_keys = [k for k in unexpected_keys if "lora_" in k and adapter_name in k] |
| 408 | if lora_unexpected_keys: |
| 409 | warn_msg = ( |
| 410 | f"Loading adapter weights from state_dict led to unexpected keys found in the model:" |
| 411 | f" {', '.join(lora_unexpected_keys)}. " |
| 412 | ) |
| 413 | |
| 414 | # Filter missing keys specific to the current adapter. |
| 415 | missing_keys = getattr(incompatible_keys, "missing_keys", None) |
| 416 | if missing_keys: |
| 417 | lora_missing_keys = [k for k in missing_keys if "lora_" in k and adapter_name in k] |
| 418 | if lora_missing_keys: |
| 419 | warn_msg += ( |
| 420 | f"Loading adapter weights from state_dict led to missing keys in the model:" |
| 421 | f" {', '.join(lora_missing_keys)}." |
| 422 | ) |
| 423 | |
| 424 | if warn_msg: |
| 425 | logger.warning(warn_msg) |
no outgoing calls
no test coverage detected
searching dependent graphs…