Use the default parameters of the original code
Browse files
app.py
CHANGED
|
@@ -50,7 +50,10 @@ def generate_caption(model_id: str, image: PIL.Image.Image,
|
|
| 50 |
temperature=temperature,
|
| 51 |
length_penalty=length_penalty,
|
| 52 |
repetition_penalty=repetition_penalty,
|
| 53 |
-
max_length=50
|
|
|
|
|
|
|
|
|
|
| 54 |
result = processor.batch_decode(generated_ids,
|
| 55 |
skip_special_tokens=True)[0].strip()
|
| 56 |
return result
|
|
@@ -70,7 +73,11 @@ def answer_question(model_id: str, image: PIL.Image.Image, text: str,
|
|
| 70 |
'Nucleus sampling',
|
| 71 |
temperature=temperature,
|
| 72 |
length_penalty=length_penalty,
|
| 73 |
-
repetition_penalty=repetition_penalty
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
result = processor.batch_decode(generated_ids,
|
| 75 |
skip_special_tokens=True)[0].strip()
|
| 76 |
return result
|
|
|
|
| 50 |
temperature=temperature,
|
| 51 |
length_penalty=length_penalty,
|
| 52 |
repetition_penalty=repetition_penalty,
|
| 53 |
+
max_length=50,
|
| 54 |
+
min_length=1,
|
| 55 |
+
num_beams=5,
|
| 56 |
+
top_p=0.9)
|
| 57 |
result = processor.batch_decode(generated_ids,
|
| 58 |
skip_special_tokens=True)[0].strip()
|
| 59 |
return result
|
|
|
|
| 73 |
'Nucleus sampling',
|
| 74 |
temperature=temperature,
|
| 75 |
length_penalty=length_penalty,
|
| 76 |
+
repetition_penalty=repetition_penalty,
|
| 77 |
+
max_length=30,
|
| 78 |
+
min_length=1,
|
| 79 |
+
num_beams=5,
|
| 80 |
+
top_p=0.9)
|
| 81 |
result = processor.batch_decode(generated_ids,
|
| 82 |
skip_special_tokens=True)[0].strip()
|
| 83 |
return result
|