Skip to content

Commit

Permalink
set num_beam default to 1 instead of completely removing it
Browse files Browse the repository at this point in the history
  • Loading branch information
152334H committed Apr 17, 2023
1 parent 6a8e6e4 commit 700f05d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ def gradio_answer(chatbot, chat_state, img_list, num_beams, temperature):

num_beams = gr.Slider(
minimum=1,
maximum=16,
value=5,
maximum=10,
value=1,
step=1,
interactive=True,
label="beam search numbers)",
Expand Down
4 changes: 2 additions & 2 deletions minigpt4/conversation/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ def ask(self, text, conv):
else:
conv.append_message(conv.roles[0], text)

def answer(self, conv, img_list, max_new_tokens=200, num_beams=5, min_length=1, top_p=0.9,
def answer(self, conv, img_list, max_new_tokens=200, num_beams=1, min_length=1, top_p=0.9,
repetition_penalty=1.0, length_penalty=1, temperature=1.0):
conv.append_message(conv.roles[1], None)
embs = self.get_context_emb(conv, img_list)
outputs = self.model.llama_model.generate(
inputs_embeds=embs,
max_new_tokens=max_new_tokens,
stopping_criteria=self.stopping_criteria,
#num_beams=num_beams,
num_beams=num_beams,
do_sample=True,
min_length=min_length,
top_p=top_p,
Expand Down

0 comments on commit 700f05d

Please sign in to comment.