Skip to content

Commit bcde70f

Browse files
committed
Torch import fixes and descriptor fixes
1 parent ea1b119 commit bcde70f

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

python/GeminiVideoSummarization/gemini_video_summarization_component/gemini_video_summarization_component.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@
5050

5151
from openai import OpenAI
5252

53-
import torch
54-
from transformers.models.gemma4.processing_gemma4 import Gemma4Processor
55-
from transformers.models.gemma4.modeling_gemma4 import Gemma4ForConditionalGeneration
5653

5754
logger = logging.getLogger('GeminiVideoSummarizationComponent')
5855

@@ -546,12 +543,9 @@ def _avoid_torchvision_endpoint_frame_index(
546543

547544
num_frames = min(num_frames, available_frame_count)
548545
while num_frames > 1:
549-
indices = torch.arange(
550-
0,
551-
available_frame_count,
552-
available_frame_count / num_frames
553-
).int()
554-
if len(indices) <= num_frames and int(indices.max()) < available_frame_count:
546+
step = available_frame_count / num_frames
547+
indices = [int(index * step) for index in range(num_frames)]
548+
if len(indices) <= num_frames and max(indices) < available_frame_count:
555549
return num_frames
556550
num_frames -= 1
557551

@@ -664,6 +658,7 @@ def _local_get_response(self, job: mpf.VideoJob, prompt: str) -> str:
664658

665659
inputs = self.processor(**processor_kwargs).to(self.device)
666660

661+
import torch
667662
with torch.no_grad():
668663
output_ids = self.model.generate(**inputs, max_new_tokens=1024)
669664

python/GeminiVideoSummarization/plugin-files/descriptor/descriptor.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,18 @@
177177
},
178178
"actions": [
179179
{
180-
"name": "GEMINI VIDEO SUMMARIZATION ACTION",
180+
"name": "GEMMA VIDEO SUMMARIZATION ACTION",
181181
"description": "Runs Gemini with a prompt for the provided video.",
182182
"algorithm": "GeminiVideo",
183183
"properties": []
184184
}
185185
],
186186
"tasks": [
187187
{
188-
"name": "GEMINI VIDEO SUMMARIZATION TASK",
188+
"name": "GEMMA VIDEO SUMMARIZATION TASK",
189189
"description": "Runs Gemini video summarization.",
190190
"actions": [
191-
"GEMINI VIDEO SUMMARIZATION ACTION"
191+
"GEMMA VIDEO SUMMARIZATION ACTION"
192192
]
193193
}
194194
],

0 commit comments

Comments
 (0)