Update handler.py
Browse files- handler.py +9 -10
handler.py
CHANGED
@@ -89,19 +89,18 @@ class EndpointHandler:
|
|
89 |
if clip is None or prompt is None:
|
90 |
return [{"error": "Missing 'clip' or 'prompt' in input data"}]
|
91 |
|
92 |
-
#
|
93 |
-
inputs_video =
|
94 |
-
text=prompt,
|
95 |
-
videos=clip,
|
96 |
-
padding=True,
|
97 |
-
return_tensors="pt"
|
98 |
-
).to(self.model.device)
|
99 |
|
100 |
-
# Debug:
|
|
|
|
|
|
|
101 |
if 'pixel_values_videos' in inputs_video:
|
102 |
-
|
|
|
103 |
else:
|
104 |
-
print("
|
105 |
|
106 |
if 'input_ids' in inputs_video:
|
107 |
print(f"input_ids shape: {inputs_video['input_ids'].shape}")
|
|
|
89 |
if clip is None or prompt is None:
|
90 |
return [{"error": "Missing 'clip' or 'prompt' in input data"}]
|
91 |
|
92 |
+
# Ensure clip_bytes is converted properly to the expected format by the model
|
93 |
+
inputs_video = ml.processor(text=prompt, videos=clip, padding=True, return_tensors="pt").to(ml.model.device)
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
+
# Debug: Print the entire inputs_video structure
|
96 |
+
print(f"Keys in inputs_video: {inputs_video.keys()}")
|
97 |
+
|
98 |
+
# Rename pixel_values_videos to pixel_values if it exists
|
99 |
if 'pixel_values_videos' in inputs_video:
|
100 |
+
inputs_video['pixel_values'] = inputs_video.pop('pixel_values_videos')
|
101 |
+
print(f"Renamed pixel_values_videos to pixel_values. New shape: {inputs_video['pixel_values'].shape}")
|
102 |
else:
|
103 |
+
print("pixel_values_videos not found in inputs_video")
|
104 |
|
105 |
if 'input_ids' in inputs_video:
|
106 |
print(f"input_ids shape: {inputs_video['input_ids'].shape}")
|