From c858452740fb2d4e2ce728f51eb39d8c97a61dea Mon Sep 17 00:00:00 2001 From: Divided by Zer0 Date: Mon, 12 Sep 2022 12:00:30 +0200 Subject: [PATCH] Added logger to fileops --- fileops.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fileops.py b/fileops.py index c303764e..a416f24d 100644 --- a/fileops.py +++ b/fileops.py @@ -3,6 +3,7 @@ from typing import Tuple, Union, Optional import os import json import zipfile +from logger import logger #==================================================================# # Generic Method for prompting for file path @@ -149,16 +150,16 @@ def getspfiles(model_dimension: int): continue z, version, shape, fortran_order, dtype = checksp(file, model_dimension) if z == 1: - print(f"Browser SP loading error: {file} is malformed or not a soft prompt ZIP file.") + logger.warning(f"Softprompt {file} is malformed or not a soft prompt ZIP file.") continue if z == 2: - print(f"Browser SP loading error: {file} tensor.npy has unsupported dtype '{dtype.name}'.") + logger.warning(f"Softprompt {file} tensor.npy has unsupported dtype '{dtype.name}'.") continue if z == 3: - print(f"Browser SP loading error: {file} tensor.npy has model dimension {shape[1]} which does not match your model's model dimension of {model_dimension}. This usually means this soft prompt is not compatible with your model.") + logger.debug(f"Softprompt {file} tensor.npy has model dimension {shape[1]} which does not match your model's model dimension of {model_dimension}. This usually means this soft prompt is not compatible with your model.") continue if z == 4: - print(f"Browser SP loading error: {file} tensor.npy has {shape[0]} tokens but it is supposed to have less than 2048 tokens.") + logger.warning(f"Softprompt {file} tensor.npy has {shape[0]} tokens but it is supposed to have less than 2048 tokens.") continue assert isinstance(z, zipfile.ZipFile) try: