Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bbq/src/utils/model_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def resolve_torch_data_type(
return torch.float32


def _from_pretrained_fast(loader_cls_or_fn: Any, model_id_or_obj: Any, **kwargs: Any) -> Any:
def _from_pretrained_fast(
loader_cls_or_fn: Any, model_id_or_obj: Any, **kwargs: Any
) -> Any:
"""Load model/adapter/processor from local huggingface cache first to avoid network latency."""
try:
return loader_cls_or_fn.from_pretrained(
Expand Down Expand Up @@ -143,13 +145,15 @@ def load_model_with_lora_adapters(
config.lora_adapter_id,
config=lora_adapter_config,
local_files_only=True,
autocast_adapter_dtype=False,
)
except Exception:
model_to_use = PeftModel.from_pretrained(
base_model,
config.lora_adapter_id,
config=lora_adapter_config,
local_files_only=False,
autocast_adapter_dtype=False,
)
except Exception as exception_instance:
raise LoRAAdapterLoadError(
Expand Down
Loading