Update handler.py
Browse files- handler.py +16 -0
handler.py
CHANGED
|
@@ -101,6 +101,22 @@ class EndpointHandler:
|
|
| 101 |
if 'pixel_values_videos' in inputs_video:
|
| 102 |
inputs_video['pixel_values'] = inputs_video.pop('pixel_values_videos')
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
# Generate output from the model
|
| 105 |
generate_kwargs = {"max_new_tokens": 512, "do_sample": True, "top_p": 0.9}
|
| 106 |
output = self.model.generate(**inputs_video, **generate_kwargs)
|
|
|
|
| 101 |
if 'pixel_values_videos' in inputs_video:
|
| 102 |
inputs_video['pixel_values'] = inputs_video.pop('pixel_values_videos')
|
| 103 |
|
| 104 |
+
if 'pixel_values' in inputs_video:
|
| 105 |
+
print(f"pixel_values shape: {inputs_video['pixel_values'].shape}")
|
| 106 |
+
else:
|
| 107 |
+
print("pixel_values not found in inputs_video")
|
| 108 |
+
|
| 109 |
+
if 'input_ids' in inputs_video:
|
| 110 |
+
print(f"input_ids shape: {inputs_video['input_ids'].shape}")
|
| 111 |
+
else:
|
| 112 |
+
print("input_ids not found in inputs_video")
|
| 113 |
+
|
| 114 |
+
if 'attention_mask' in inputs_video:
|
| 115 |
+
print(f"attention_mask shape: {inputs_video['attention_mask'].shape}")
|
| 116 |
+
else:
|
| 117 |
+
print("attention_mask not found in inputs_video")
|
| 118 |
+
|
| 119 |
+
|
| 120 |
# Generate output from the model
|
| 121 |
generate_kwargs = {"max_new_tokens": 512, "do_sample": True, "top_p": 0.9}
|
| 122 |
output = self.model.generate(**inputs_video, **generate_kwargs)
|