juanpablomesa
commited on
Commit
·
54d363d
1
Parent(s):
7c13868
Returned to ThreadPoolExecutor
Browse files- handler.py +2 -2
handler.py
CHANGED
@@ -9,7 +9,7 @@ import torch
|
|
9 |
from PIL import Image
|
10 |
from transformers import AutoTokenizer, XCLIPModel, XCLIPProcessor
|
11 |
from huggingface_hub import logging
|
12 |
-
from concurrent.futures import ThreadPoolExecutor,
|
13 |
from decord import VideoReader
|
14 |
from decord import cpu
|
15 |
|
@@ -237,7 +237,7 @@ class EndpointHandler:
|
|
237 |
videos_urls = data["videos_urls"][i : i + batch_size]
|
238 |
videos_metadata = data["videos_metadata"][i : i + batch_size]
|
239 |
|
240 |
-
with
|
241 |
futures = [
|
242 |
executor.submit(self.process_video, url, metadata)
|
243 |
for url, metadata in zip(videos_urls, videos_metadata)
|
|
|
9 |
from PIL import Image
|
10 |
from transformers import AutoTokenizer, XCLIPModel, XCLIPProcessor
|
11 |
from huggingface_hub import logging
|
12 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
13 |
from decord import VideoReader
|
14 |
from decord import cpu
|
15 |
|
|
|
237 |
videos_urls = data["videos_urls"][i : i + batch_size]
|
238 |
videos_metadata = data["videos_metadata"][i : i + batch_size]
|
239 |
|
240 |
+
with ThreadPoolExecutor() as executor:
|
241 |
futures = [
|
242 |
executor.submit(self.process_video, url, metadata)
|
243 |
for url, metadata in zip(videos_urls, videos_metadata)
|