from concurrent.futures import ThreadPoolExecutor
# Cargar y optimizar una imagen decoder = ImageDecoder("datos_imagenes/", format="auto") imagenes_procesadas = decoder.decode_batch() # Procesar multiples imágenes import torch from leptonai.dataset import LeptonDataset descargar lepton optimizer en espa full build better
with ThreadPoolExecutor(max_workers=4) as executor: resultados = executor.map(procesar_imagenes, lotes_de_imagenes) Si usas una GPU NVIDIA, habilita CUDA (si Lepton lo soporta): from concurrent
def procesar_imagenes(img_batch): return [ImageDecoder.decode(img) for img in img_batch] lotes_de_imagenes) Si usas una GPU NVIDIA