Spaces:
Running
Running
Latest Changes
Browse files- core/model_loader.py +0 -4
core/model_loader.py
CHANGED
|
@@ -37,19 +37,15 @@ def generate_caption(
|
|
| 37 |
|
| 38 |
# Style-specific decoding
|
| 39 |
if style == "Image Explanation":
|
| 40 |
-
max_len = 140
|
| 41 |
min_len = 80
|
| 42 |
elif style == "Detailed Caption":
|
| 43 |
-
max_len = 90
|
| 44 |
min_len = 50
|
| 45 |
else:
|
| 46 |
-
max_len = 40
|
| 47 |
min_len = 20
|
| 48 |
|
| 49 |
with torch.inference_mode():
|
| 50 |
output_ids = model.generate(
|
| 51 |
**inputs,
|
| 52 |
-
max_length=max_len,
|
| 53 |
min_length=min_len,
|
| 54 |
do_sample=True,
|
| 55 |
top_p=0.9,
|
|
|
|
| 37 |
|
| 38 |
# Style-specific decoding
|
| 39 |
if style == "Image Explanation":
|
|
|
|
| 40 |
min_len = 80
|
| 41 |
elif style == "Detailed Caption":
|
|
|
|
| 42 |
min_len = 50
|
| 43 |
else:
|
|
|
|
| 44 |
min_len = 20
|
| 45 |
|
| 46 |
with torch.inference_mode():
|
| 47 |
output_ids = model.generate(
|
| 48 |
**inputs,
|
|
|
|
| 49 |
min_length=min_len,
|
| 50 |
do_sample=True,
|
| 51 |
top_p=0.9,
|