Skip to content

Commit dcc82b9

Browse files
anirudhs001anirudhJack-Khuu
authored
Added support for Multimodal eval (#1499)
* [wip] Added cli args and other changes to eval multi-modal models * remove redundant comment * Added Llama3VisionTransform in TokenizerArgs and other changes * use kv caching and other minor fixes * default batch size 1 * lint eval.py and builder.py * lm-eval 0.4.2->0.4.7 in install_requirements.sh * fixes from code review * remove modality from builder args * use custom prefix token * move torchtune imports inside VLMEvalWrapper * revert changes from builder.py * instantiate transform in eval() --------- Co-authored-by: anirudh <[email protected]> Co-authored-by: Jack-Khuu <[email protected]>
1 parent 4d8bab5 commit dcc82b9

File tree

6 files changed

+331
-17
lines changed

6 files changed

+331
-17
lines changed

install/install_requirements.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,5 @@ if [[ -x "$(command -v nvidia-smi)" ]]; then
136136
fi
137137
(
138138
set -x
139-
$PIP_EXECUTABLE install evaluate=="0.4.3" lm-eval=="0.4.2" psutil=="6.0.0"
139+
$PIP_EXECUTABLE install evaluate=="0.4.3" lm-eval=="0.4.7" psutil=="6.0.0"
140140
)

install/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ streamlit
3434
flask
3535

3636
# eval
37-
lm_eval==0.4.2
37+
lm_eval==0.4.7

torchchat/cli/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,4 +794,4 @@ def tokenizer_setting_to_name(tiktoken: bool, tokenizers: bool) -> str:
794794
return "TikToken"
795795
if tokenizers:
796796
return "Tokenizers"
797-
return "SentencePiece"
797+
return "SentencePiece"

torchchat/cli/cli.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,14 @@ def _add_evaluation_args(parser) -> None:
432432
help="Maximum length sequence to evaluate",
433433
)
434434

435+
eval_parser.add_argument(
436+
"--modality",
437+
type=str,
438+
default="text",
439+
choices=["text", "text-image"],
440+
help="Modality of the model. Options: text, text-image",
441+
)
442+
435443

436444
# Add CLI Args related to distributed inference
437445
# This feature is currently a [WIP] and hidden from --help

torchchat/model.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,12 @@ def setup_caches(self, batch_size, dtype, encoder_max_seq_len, decoder_max_seq_l
608608
decoder_max_seq_len=decoder_max_seq_len,
609609
)
610610

611+
def caches_are_setup(self) -> bool:
612+
return self.model.caches_are_setup()
613+
614+
def caches_are_enabled(self) -> bool:
615+
return self.model.caches_are_enabled()
616+
611617
def reset_caches(self):
612618
self.model.reset_caches()
613619

0 commit comments

Comments
 (0)