Skip to content

Commit

Permalink
[Fix] Fix the error when running models caused by `generate_until_mul…
Browse files Browse the repository at this point in the history
…ti_round` (#281)

* fix

* lint
  • Loading branch information
pufanyi authored Sep 26, 2024
1 parent 9d227f7 commit ff0802c
Show file tree
Hide file tree
Showing 34 changed files with 102 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lmms_eval/models/batch_gpt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,6 @@ def cancel_batch(self, batch_id):

def list_batches(self, limit=10):
return self.client.batches.list(limit=limit)

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for BatchGPT4")
3 changes: 3 additions & 0 deletions lmms_eval/models/cambrian.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,6 @@ def _collate(x):
res = re_ords.get_original(res)
pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for Cambrian")
3 changes: 3 additions & 0 deletions lmms_eval/models/claude.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,6 @@ def generate_until(self, requests) -> List[str]:

def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
assert False, "Not supported for claude"

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for Claude")
3 changes: 3 additions & 0 deletions lmms_eval/models/cogvlm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for CogVLM2")
3 changes: 3 additions & 0 deletions lmms_eval/models/from_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ def generate_until(self, requests) -> List[str]:
def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
# TODO
assert False, "not support"

def generate_until_multi_round(self, requests) -> List[str]:
return generate_until(self, requests)
3 changes: 3 additions & 0 deletions lmms_eval/models/fuyu.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,6 @@ def tok_encode(self, string: str, left_truncate_len=None, add_special_tokens=Non

def tok_decode(self, tokens):
return self.tokenizer.decode(tokens)

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for Fuyu")
3 changes: 3 additions & 0 deletions lmms_eval/models/gemini_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ def get_uuid(task, split, doc_id):
pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for Gemini API")

def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
# TODO
assert False, "Gemini API not support"
3 changes: 3 additions & 0 deletions lmms_eval/models/gpt4v.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ def generate_until(self, requests) -> List[str]:
pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for GPT4V")

def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
# TODO
assert False, "GPT4V not support"
3 changes: 3 additions & 0 deletions lmms_eval/models/idefics2.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for Idefics2")
3 changes: 3 additions & 0 deletions lmms_eval/models/instructblip.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for InstructBlip")
3 changes: 3 additions & 0 deletions lmms_eval/models/internvl.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,6 @@ def _collate(x):

def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
pass

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for InternVL")
3 changes: 3 additions & 0 deletions lmms_eval/models/internvl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,6 @@ def generate_until(self, requests) -> List[str]:

def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
assert False, "Not implemented yet."

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for InternVL2")
3 changes: 3 additions & 0 deletions lmms_eval/models/llama_vid.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,6 @@ def rank(self):
@property
def world_size(self):
return self._world_size

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for LLaMAVid")
3 changes: 3 additions & 0 deletions lmms_eval/models/llava.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for LLaVA")
3 changes: 3 additions & 0 deletions lmms_eval/models/llava_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for LLaVAHF")
3 changes: 3 additions & 0 deletions lmms_eval/models/llava_sglang.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,6 @@ def prepare_arguments_parallel(contexts, batched_visuals, max_workers=64):
pbar.close()
runtime.shutdown()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for LLaVA-SGLang")
3 changes: 3 additions & 0 deletions lmms_eval/models/llava_vid.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,6 @@ def generate_until(self, requests) -> List[str]:
res.append(outputs)
pbar.update(1)
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for LLaVAVid")
3 changes: 3 additions & 0 deletions lmms_eval/models/longva.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for LongVA")
3 changes: 3 additions & 0 deletions lmms_eval/models/mantis.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation for Mantis")
3 changes: 3 additions & 0 deletions lmms_eval/models/minicpm_v.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/minimonkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ def _collate(x):
pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")


import numpy as np
import torchvision.transforms as T
Expand Down
3 changes: 3 additions & 0 deletions lmms_eval/models/mplug_owl_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,6 @@ def generate_until(self, requests) -> List[str]:

def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
return super().loglikelihood(requests)

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/phi3v.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,6 @@ def _collate(x):
res = re_ords.get_original(res)
pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/qwen2_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/qwen_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/qwen_vl_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,6 @@ def flatten(self, input):
for j in i:
new_list.append(j)
return new_list

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/reka.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,6 @@ def generate_until(self, requests) -> List[str]:
def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
# TODO
assert False, "Reka not support loglikelihood"

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/srt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,6 @@ async def _process(request):
def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
# TODO
assert False, "GPT4V not support"

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/tinyllava.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,6 @@ def _collate(x):

pbar.close()
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/video_chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,6 @@ def rank(self):
@property
def world_size(self):
return self._world_size

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/video_llava.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,6 @@ def generate_until(self, requests) -> List[str]:
res.append(outputs)
pbar.update(1)
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/vila.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,6 @@ def generate_until(self, requests) -> List[str]:
res.append(outputs)
pbar.update(1)
return res

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")
3 changes: 3 additions & 0 deletions lmms_eval/models/xcomposer2_4KHD.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ def generate_until(self, requests) -> List[str]:
def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
return super().loglikelihood(requests)

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")


def padding_336(b):
width, height = b.size
Expand Down
3 changes: 3 additions & 0 deletions lmms_eval/models/xcomposer2d5.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,6 @@ def generate_until(self, requests) -> List[str]:

def loglikelihood(self, requests: List[Instance]) -> List[Tuple[float, bool]]:
assert False, "Not implemented yet."

def generate_until_multi_round(self, requests) -> List[str]:
raise NotImplementedError("TODO: Implement multi-round generation")

0 comments on commit ff0802c

Please sign in to comment.