Remove an error message

This commit is contained in:
oobabooga 2023-09-17 18:46:08 -07:00
parent 661bfaac8e
commit 0ede2965d5
2 changed files with 1 additions and 3 deletions

View File

@ -48,4 +48,4 @@ def count_tokens(text):
tokens = get_encoded_length(text) tokens = get_encoded_length(text)
return str(tokens) return str(tokens)
except: except:
return '-1' return '0'

View File

@ -107,7 +107,6 @@ def _generate_reply(question, state, stopping_strings=None, is_chat=False, escap
def encode(prompt, add_special_tokens=True, add_bos_token=True, truncation_length=None): def encode(prompt, add_special_tokens=True, add_bos_token=True, truncation_length=None):
if shared.tokenizer is None: if shared.tokenizer is None:
logger.error('No tokenizer is loaded')
raise ValueError('No tokenizer is loaded') raise ValueError('No tokenizer is loaded')
if shared.model.__class__.__name__ in ['LlamaCppModel', 'RWKVModel', 'CtransformersModel', 'Exllamav2Model']: if shared.model.__class__.__name__ in ['LlamaCppModel', 'RWKVModel', 'CtransformersModel', 'Exllamav2Model']:
@ -138,7 +137,6 @@ def encode(prompt, add_special_tokens=True, add_bos_token=True, truncation_lengt
def decode(output_ids, skip_special_tokens=True): def decode(output_ids, skip_special_tokens=True):
if shared.tokenizer is None: if shared.tokenizer is None:
logger.error('No tokenizer is loaded')
raise ValueError('No tokenizer is loaded') raise ValueError('No tokenizer is loaded')
return shared.tokenizer.decode(output_ids, skip_special_tokens) return shared.tokenizer.decode(output_ids, skip_special_tokens)