Repository navigation
Conversation
|
|
||
| if use_safetensors is None: | ||
| use_safetensors = True | ||
| allow_pickle = True |
There was a problem hiding this comment.
What does it have to do with allow_pickle?
There was a problem hiding this comment.
Once use_safetensors defaults to True, _fetch_state_dict tries the .safetensors file first, and on an IOError it only falls back to the .bin file when allow_pickle is set. Without it, adapters that only ship pytorch_lora_weights.bin would stop loading through load_lora_adapter, while they load today. This mirrors what load_lora_weights already does in lora_pipeline.py (allow_pickle = True when use_safetensors is not passed). An explicit use_safetensors=True still keeps the strict behaviour.
|
Thanks for the review! The two red checks don't come from this change. The LoRA CUDA job fails on one Flux 3 test that gets a 401 from a gated repo ( |
What does this PR do?
load_lora_adaptercouldn't load a folder written bysave_lora_adapterwith default arguments. The save writespytorch_lora_weights.safetensors, but the load passeduse_safetensors=Nonethrough to_fetch_state_dict, which then only looked forpytorch_lora_weights.bin.The fix applies the same default
load_lora_weightsand the other loaders already use: whenuse_safetensorsis not set, try safetensors first and allow falling back to a.binfile.The shared
LoraTesterMixin.test_save_load_lora_adapterround trip passeduse_safetensors=Trueon load, which hid this. I removed that argument so the test covers a default save and default load. Explicituse_safetensors=Truestays covered by the other tests in the mixin.Fixes #15463
Tests
Self-review notes
I ran the
self-reviewrubric over the diff. No blocking issues and no dead code. The change adds no comments or docstrings, andload_lora_adapter's docstring doesn't documentuse_safetensors, so no docs needed updating. Nothing was left unfixed.Before submitting
self-reviewskill on the diff?Who can review?
@sayakpaul