mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-04-06 15:13:38 +00:00
Address copilot feedback
This commit is contained in:
parent
24fdcc52b3
commit
04213dff14
6 changed files with 14 additions and 6 deletions
|
|
@ -136,7 +136,7 @@ class LlamaServer:
|
|||
|
||||
logit_bias = []
|
||||
if state['custom_token_bans']:
|
||||
logit_bias.extend([[int(token_id), False] for token_id in state['custom_token_bans'].split(',')])
|
||||
logit_bias.extend([[int(token_id.strip()), False] for token_id in state['custom_token_bans'].split(',') if token_id.strip()])
|
||||
|
||||
if state.get('logit_bias'):
|
||||
for token_id_str, bias in state['logit_bias'].items():
|
||||
|
|
|
|||
|
|
@ -431,7 +431,8 @@ def load_instruction_template(template):
|
|||
else:
|
||||
return ''
|
||||
|
||||
file_contents = open(filepath, 'r', encoding='utf-8').read()
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
file_contents = f.read()
|
||||
data = yaml.safe_load(file_contents)
|
||||
if 'instruction_template' in data:
|
||||
return data['instruction_template']
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ def generate_reply_HF(question, original_question, state, stopping_strings=None,
|
|||
generate_params['sampler_priority'] = [x.strip() for x in state['sampler_priority'].replace('\n', ',').split(',') if x.strip()]
|
||||
|
||||
if state['custom_token_bans']:
|
||||
to_ban = [int(x) for x in state['custom_token_bans'].split(',')]
|
||||
to_ban = [int(x.strip()) for x in state['custom_token_bans'].split(',') if x.strip()]
|
||||
if len(to_ban) > 0:
|
||||
if generate_params.get('suppress_tokens', None):
|
||||
generate_params['suppress_tokens'] += to_ban
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ def load_tools(selected_names):
|
|||
continue
|
||||
|
||||
func_name = tool_def.get('function', {}).get('name', name)
|
||||
if func_name in executors:
|
||||
logger.warning(f'Tool "{name}" declares function name "{func_name}" which conflicts with an already loaded tool. Skipping.')
|
||||
continue
|
||||
tool_defs.append(tool_def)
|
||||
executors[func_name] = execute_fn
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue