fix the demo error when temperature = 2

This commit is contained in:
Deyao Zhu 2023-10-16 16:01:20 +03:00
parent cb8f011e70
commit 468b452a8a
3 changed files with 5 additions and 4 deletions

View File

@ -549,7 +549,7 @@ with gr.Blocks() as demo:
temperature = gr.Slider( temperature = gr.Slider(
minimum=0.1, minimum=0.1,
maximum=2.0, maximum=1.5,
value=1.0, value=1.0,
step=0.1, step=0.1,
interactive=True, interactive=True,

View File

@ -170,7 +170,7 @@ class Chat:
top_p=top_p, top_p=top_p,
repetition_penalty=repetition_penalty, repetition_penalty=repetition_penalty,
length_penalty=length_penalty, length_penalty=length_penalty,
temperature=temperature, temperature=float(temperature),
) )
return generation_kwargs return generation_kwargs

View File

@ -7,6 +7,7 @@ import torch.nn as nn
from minigpt4.common.registry import registry from minigpt4.common.registry import registry
from minigpt4.models.base_model import BaseModel from minigpt4.models.base_model import BaseModel
from transformers import StoppingCriteria, StoppingCriteriaList
@ -365,8 +366,8 @@ class MiniGPTBase(BaseModel):
do_sample=do_sample, do_sample=do_sample,
min_length=min_length, min_length=min_length,
top_p=top_p, top_p=top_p,
repetition_penalty=repetition_penalty repetition_penalty=repetition_penalty,
# stopping_criteria=stopping_criteria, stopping_criteria=stopping_criteria,
) )
answers = [] answers = []