modify style & little change
Former-commit-id: c988477d14dc656450d5fec31895781b7f9f7dce
This commit is contained in:
@@ -165,8 +165,17 @@ class HuggingfaceEngine(BaseEngine):
|
||||
)
|
||||
|
||||
mm_inputs = template.mm_plugin.get_mm_inputs(**mm_input_dict, seqlens=[prompt_length], processor=processor)
|
||||
|
||||
for key, value in mm_inputs.items():
|
||||
value = value if isinstance(value, torch.Tensor) else torch.tensor(value)
|
||||
value = (
|
||||
value
|
||||
if isinstance(value, torch.Tensor)
|
||||
else (
|
||||
torch.stack(value)
|
||||
if isinstance(value, list) and all(isinstance(v, torch.Tensor) for v in value)
|
||||
else torch.tensor(value)
|
||||
)
|
||||
)
|
||||
gen_kwargs[key] = value.to(model.device)
|
||||
|
||||
return gen_kwargs, prompt_length
|
||||
|
||||
Reference in New Issue
Block a user