modify style & little change
This commit is contained in:
1 parent
9b2642a2b5
commit
9d6143e36a
7 files changed
+45
-25
No files matched your search
@@ -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