@@ -1367,6 +1367,14 @@ def load_lora_into_transformer(
1367
1367
f" { unexpected_keys } . "
1368
1368
)
1369
1369
1370
+ # Filter missing keys specific to the current adapter.
1371
+ missing_keys = getattr (incompatible_keys , "missing_keys" , None )
1372
+ if missing_keys :
1373
+ logger .warning (
1374
+ f"Loading adapter weights from state_dict led to missing keys in the model: "
1375
+ f" { missing_keys } . "
1376
+ )
1377
+
1370
1378
# Offload back.
1371
1379
if is_model_cpu_offload :
1372
1380
_pipeline .enable_model_cpu_offload ()
@@ -1933,14 +1941,22 @@ def load_lora_into_transformer(
1933
1941
incompatible_keys = set_peft_model_state_dict (transformer , state_dict , adapter_name , ** peft_kwargs )
1934
1942
1935
1943
if incompatible_keys is not None :
1936
- # check only for unexpected keys
1944
+ # Check only for unexpected keys.
1937
1945
unexpected_keys = getattr (incompatible_keys , "unexpected_keys" , None )
1938
1946
if unexpected_keys :
1939
1947
logger .warning (
1940
1948
f"Loading adapter weights from state_dict led to unexpected keys not found in the model: "
1941
1949
f" { unexpected_keys } . "
1942
1950
)
1943
1951
1952
+ # Filter missing keys specific to the current adapter.
1953
+ missing_keys = getattr (incompatible_keys , "missing_keys" , None )
1954
+ if missing_keys :
1955
+ logger .warning (
1956
+ f"Loading adapter weights from state_dict led to missing keys in the model: "
1957
+ f" { missing_keys } . "
1958
+ )
1959
+
1944
1960
# Offload back.
1945
1961
if is_model_cpu_offload :
1946
1962
_pipeline .enable_model_cpu_offload ()
@@ -2288,6 +2304,14 @@ def load_lora_into_transformer(cls, state_dict, network_alphas, transformer, ada
2288
2304
f" { unexpected_keys } . "
2289
2305
)
2290
2306
2307
+ # Filter missing keys specific to the current adapter.
2308
+ missing_keys = getattr (incompatible_keys , "missing_keys" , None )
2309
+ if missing_keys :
2310
+ logger .warning (
2311
+ f"Loading adapter weights from state_dict led to missing keys in the model: "
2312
+ f" { missing_keys } . "
2313
+ )
2314
+
2291
2315
# Offload back.
2292
2316
if is_model_cpu_offload :
2293
2317
_pipeline .enable_model_cpu_offload ()
@@ -2726,6 +2750,14 @@ def load_lora_into_transformer(
2726
2750
f" { unexpected_keys } . "
2727
2751
)
2728
2752
2753
+ # Filter missing keys specific to the current adapter.
2754
+ missing_keys = getattr (incompatible_keys , "missing_keys" , None )
2755
+ if missing_keys :
2756
+ logger .warning (
2757
+ f"Loading adapter weights from state_dict led to missing keys in the model: "
2758
+ f" { missing_keys } . "
2759
+ )
2760
+
2729
2761
# Offload back.
2730
2762
if is_model_cpu_offload :
2731
2763
_pipeline .enable_model_cpu_offload ()
0 commit comments