Prevent unwanted log messages from modules

This commit is contained in:
oobabooga 2023-05-21 22:42:34 -03:00
parent fb91406e93
commit e116d31180
20 changed files with 120 additions and 111 deletions

View file

@ -1,10 +1,10 @@
import logging
from pathlib import Path
import torch
from peft import PeftModel
import modules.shared as shared
from modules.logging_colors import logger
def add_lora_to_model(lora_names):
@ -19,7 +19,7 @@ def add_lora_to_model(lora_names):
# Add a LoRA when another LoRA is already present
if len(removed_set) == 0 and len(prior_set) > 0:
logging.info(f"Adding the LoRA(s) named {added_set} to the model...")
logger.info(f"Adding the LoRA(s) named {added_set} to the model...")
for lora in added_set:
shared.model.load_adapter(Path(f"{shared.args.lora_dir}/{lora}"), lora)
@ -31,7 +31,7 @@ def add_lora_to_model(lora_names):
shared.model = shared.model.base_model.model
if len(lora_names) > 0:
logging.info("Applying the following LoRAs to {}: {}".format(shared.model_name, ', '.join(lora_names)))
logger.info("Applying the following LoRAs to {}: {}".format(shared.model_name, ', '.join(lora_names)))
params = {}
if not shared.args.cpu:
params['dtype'] = shared.model.dtype