Skip to content

Commit

Permalink
Remove Multi-threaded image conversion for fast image processors (#36105
Browse files Browse the repository at this point in the history
)

remove multithreaded image conversion

Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
  • Loading branch information
yonigozlan and SunMarc authored Feb 10, 2025
1 parent 3897f2c commit 924f1c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/transformers/image_processing_utils_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from concurrent.futures import ThreadPoolExecutor
from functools import lru_cache, partial
from typing import Any, Dict, Iterable, List, Optional, Tuple, TypedDict, Union

Expand Down Expand Up @@ -497,8 +496,10 @@ def _prepare_input_images(
input_data_format=input_data_format,
device=device,
)
with ThreadPoolExecutor() as executor:
processed_images = list(executor.map(process_image_fn, images))
# todo: yoni - check if we can parallelize this efficiently
processed_images = []
for image in images:
processed_images.append(process_image_fn(image))

return processed_images

Expand Down

0 comments on commit 924f1c7

Please sign in to comment.