Update libra/eval/run_libra.py
Browse files- libra/eval/run_libra.py +6 -2
libra/eval/run_libra.py
CHANGED
|
@@ -159,7 +159,11 @@ def libra_eval(
|
|
| 159 |
else:
|
| 160 |
qs = DEFAULT_IMAGE_TOKEN + '\n' + qs
|
| 161 |
|
| 162 |
-
if '
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
mode_conv = "libra_v1"
|
| 164 |
|
| 165 |
if conv_mode is not None and mode_conv != conv_mode:
|
|
@@ -178,7 +182,7 @@ def libra_eval(
|
|
| 178 |
|
| 179 |
image_tensor = get_image_tensors(image_file, image_processor, model, device=device)
|
| 180 |
|
| 181 |
-
stop_str = conv.sep if conv.sep_style
|
| 182 |
keywords = [stop_str]
|
| 183 |
stopping_criteria = KeywordsStoppingCriteria(keywords, tokenizer, input_ids)
|
| 184 |
|
|
|
|
| 159 |
else:
|
| 160 |
qs = DEFAULT_IMAGE_TOKEN + '\n' + qs
|
| 161 |
|
| 162 |
+
if 'llama-3' in model_name.lower():
|
| 163 |
+
mode_conv = "libra_llama_3"
|
| 164 |
+
if 'mistral' in model_name.lower():
|
| 165 |
+
mode_conv = "mistral_instruct"
|
| 166 |
+
else:
|
| 167 |
mode_conv = "libra_v1"
|
| 168 |
|
| 169 |
if conv_mode is not None and mode_conv != conv_mode:
|
|
|
|
| 182 |
|
| 183 |
image_tensor = get_image_tensors(image_file, image_processor, model, device=device)
|
| 184 |
|
| 185 |
+
stop_str = conv.sep if conv.sep_style not in {SeparatorStyle.TWO, SeparatorStyle.LLAMA_3} else conv.sep2
|
| 186 |
keywords = [stop_str]
|
| 187 |
stopping_criteria = KeywordsStoppingCriteria(keywords, tokenizer, input_ids)
|
| 188 |
|