This commit is contained in:
oobabooga 2023-09-19 13:13:13 -07:00
parent 13ac55fa18
commit 869f47fff9
4 changed files with 5 additions and 5 deletions

View File

@ -530,7 +530,7 @@ def load_character_memoized(character, name1, name2, instruct=False):
def upload_character(file, img, tavern=False): def upload_character(file, img, tavern=False):
decoded_file = file if type(file) == str else file.decode('utf-8') decoded_file = file if isinstance(file, str) else file.decode('utf-8')
try: try:
data = json.loads(decoded_file) data = json.loads(decoded_file)
except: except:

View File

@ -71,7 +71,7 @@ def load_metadata(fname):
ti_data_count = struct.unpack("<Q", file.read(8))[0] ti_data_count = struct.unpack("<Q", file.read(8))[0]
kv_data_count = struct.unpack("<Q", file.read(8))[0] kv_data_count = struct.unpack("<Q", file.read(8))[0]
if GGUF_VERSION == 1: if GGUF_VERSION == 1:
raise Exception('You are using an outdated GGUF, please download a new one.') raise Exception('You are using an outdated GGUF, please download a new one.')
for i in range(kv_data_count): for i in range(kv_data_count):

View File

@ -316,8 +316,8 @@ def generate_reply_HF(question, original_question, seed, state, stopping_strings
generate_params['stopping_criteria'].append(_StopEverythingStoppingCriteria()) generate_params['stopping_criteria'].append(_StopEverythingStoppingCriteria())
processor = state.get('logits_processor', LogitsProcessorList([])) processor = state.get('logits_processor', LogitsProcessorList([]))
# In case folks just pass in a processor by itself. # In case a processor is passed by itself.
if type(processor) != LogitsProcessorList: if not isinstance(processor, LogitsProcessorList):
processor = LogitsProcessorList([processor]) processor = LogitsProcessorList([processor])
apply_extensions('logits_processor', processor, input_ids) apply_extensions('logits_processor', processor, input_ids)
generate_params['logits_processor'] = processor generate_params['logits_processor'] = processor

View File

@ -92,7 +92,7 @@ def create_event_handlers():
def load_session(file, state): def load_session(file, state):
decoded_file = file if type(file) == str else file.decode('utf-8') decoded_file = file if isinstance(file, str) else file.decode('utf-8')
data = json.loads(decoded_file) data = json.loads(decoded_file)
if 'character_menu' in data and state.get('character_menu') != data.get('character_menu'): if 'character_menu' in data and state.get('character_menu') != data.get('character_menu'):