Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] llava_hf generate until issue #386

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions lmms_eval/models/llava_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def __init__(
device_map: str = "",
chat_template: Optional[str] = None,
use_cache: bool = True,
specified_eot_token_id: Optional[int] = None,
max_frames_num: Optional[int] = 32,
**kwargs,
) -> None:
Expand Down Expand Up @@ -106,7 +105,6 @@ def __init__(
self.batch_size_per_gpu = int(batch_size)
self.chat_template = chat_template
self.use_cache = use_cache
self.specified_eot_token_id = specified_eot_token_id
if accelerator.num_processes > 1 and device_map == "":
assert accelerator.distributed_type in [DistributedType.FSDP, DistributedType.MULTI_GPU, DistributedType.DEEPSPEED], "Unsupported distributed type provided. Only DDP and FSDP are supported."
# If you want to use DistributedType.DEEPSPEED, you have to run accelerate config before using the model
Expand Down Expand Up @@ -368,8 +366,8 @@ def _collate(x):
num_beams=gen_kwargs["num_beams"],
max_new_tokens=gen_kwargs["max_new_tokens"],
use_cache=self.use_cache,
pad_token_id=self.tokenizer.eos_token_id,
eos_token_id=self.specified_eot_token_id,
pad_token_id=self.eot_token_id,
eos_token_id=self.eot_token_id,
)
cont = cont[:, inputs["input_ids"].shape[-1] :]
except Exception as e:
Expand Down
Loading