Skip to content

Commit 1ccbcf1

Browse files
committed
Use is_peft_available
1 parent c3ff898 commit 1ccbcf1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/chronos/chronos2/pipeline.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ def fit(
162162
import torch.cuda
163163
from transformers.training_args import TrainingArguments
164164

165-
try:
166-
from peft import LoraConfig, get_peft_model
167-
except:
168-
if finetune_mode == "lora":
165+
if finetune_mode == "lora":
166+
if is_peft_available():
167+
from peft import LoraConfig, get_peft_model
168+
else:
169169
warnings.warn(
170170
"`peft` is required for `finetune_mode='lora'`. Please install it with `pip install peft`. Falling back to `finetune_mode='full'`."
171171
)

0 commit comments

Comments
 (0)