mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-02-04 11:27:33 +01:00
Added logger to fileops
This commit is contained in:
parent
68aaef9090
commit
c858452740
@ -3,6 +3,7 @@ from typing import Tuple, Union, Optional
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import zipfile
|
import zipfile
|
||||||
|
from logger import logger
|
||||||
|
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
# Generic Method for prompting for file path
|
# Generic Method for prompting for file path
|
||||||
@ -149,16 +150,16 @@ def getspfiles(model_dimension: int):
|
|||||||
continue
|
continue
|
||||||
z, version, shape, fortran_order, dtype = checksp(file, model_dimension)
|
z, version, shape, fortran_order, dtype = checksp(file, model_dimension)
|
||||||
if z == 1:
|
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
|
continue
|
||||||
if z == 2:
|
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
|
continue
|
||||||
if z == 3:
|
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
|
continue
|
||||||
if z == 4:
|
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
|
continue
|
||||||
assert isinstance(z, zipfile.ZipFile)
|
assert isinstance(z, zipfile.ZipFile)
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user