|
51 | 51 |
|
52 | 52 | logger = logging.get_logger(__name__)
|
53 | 53 |
|
| 54 | +LORA_WEIGHT_NAME = "pytorch_lora_weights.bin" |
| 55 | +LORA_WEIGHT_NAME_SAFE = "pytorch_lora_weights.safetensors" |
| 56 | + |
54 | 57 |
|
55 | 58 | def fuse_text_encoder_lora(text_encoder, lora_scale=1.0, safe_fusing=False, adapter_names=None):
|
56 | 59 | """
|
@@ -195,8 +198,6 @@ def _fetch_state_dict(
|
195 | 198 | user_agent,
|
196 | 199 | allow_pickle,
|
197 | 200 | ):
|
198 |
| - from .lora_pipeline import LORA_WEIGHT_NAME, LORA_WEIGHT_NAME_SAFE |
199 |
| - |
200 | 201 | model_file = None
|
201 | 202 | if not isinstance(pretrained_model_name_or_path_or_dict, dict):
|
202 | 203 | # Let's first try to load .safetensors weights
|
@@ -260,8 +261,6 @@ def _fetch_state_dict(
|
260 | 261 | def _best_guess_weight_name(
|
261 | 262 | pretrained_model_name_or_path_or_dict, file_extension=".safetensors", local_files_only=False
|
262 | 263 | ):
|
263 |
| - from .lora_pipeline import LORA_WEIGHT_NAME, LORA_WEIGHT_NAME_SAFE |
264 |
| - |
265 | 264 | if local_files_only or HF_HUB_OFFLINE:
|
266 | 265 | raise ValueError("When using the offline mode, you must specify a `weight_name`.")
|
267 | 266 |
|
@@ -722,8 +721,6 @@ def write_lora_layers(
|
722 | 721 | save_function: Callable,
|
723 | 722 | safe_serialization: bool,
|
724 | 723 | ):
|
725 |
| - from .lora_pipeline import LORA_WEIGHT_NAME, LORA_WEIGHT_NAME_SAFE |
726 |
| - |
727 | 724 | if os.path.isfile(save_directory):
|
728 | 725 | logger.error(f"Provided path ({save_directory}) should be a directory, not a file")
|
729 | 726 | return
|
|
0 commit comments