---
title: "Accelerating Vision-Language Models: BridgeTower on Habana Gaudi2"
description: "Fine-tuning the 866M-parameter BridgeTower vision-language model with Optimum Habana on Gaudi2 reaches 847.7 samples/s, about 1.4x faster than H100 and 2.45x faster than A100 80GB, mostly because image data loading is the bottleneck."
url: "https://swe.quest/articles/accelerating-vision-language-models-bridgetower-on-habana-gaudi2-c636dc65d8f4aecd"
canonical: "https://huggingface.co/blog/bridgetower"
source: "Hugging Face"
published: "2023-06-29"
difficulty: "medium"
kind: "Research"
reading_minutes: 9
tags: ["model-training","hardware","performance","computer-vision"]
---

# Accelerating Vision-Language Models: BridgeTower on Habana Gaudi2

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-06-29, 9 min read, Research. Original: [https://huggingface.co/blog/bridgetower](https://huggingface.co/blog/bridgetower)

## Summary

Fine-tuning the 866M-parameter BridgeTower vision-language model with Optimum Habana on Gaudi2 reaches 847.7 samples/s, about 1.4x faster than H100 and 2.45x faster than A100 80GB, mostly because image data loading is the bottleneck. Raising Transformers' dataloader\_num\_workers from 0 to 1 or 2 gives easy speedups: 1.28x on Gaudi2, 1.79x on H100 and 1.52x on A100. Gaudi2's media pipeline (--mediapipe\_dataloader) adds about 1.10x more by sending encoded images to the device for decoding and augmentation. The tradeoff is higher device memory use, and there is no gain if the accelerators are already saturated. Full reproduction commands are provided.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)

## Prerequisites

- PyTorch data loading
- Hugging Face Transformers Trainer
- mixed-precision training ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))

## Keywords

BridgeTower, Habana Gaudi2, Optimum Habana, Nvidia H100, Nvidia A100, Hugging Face Transformers

## Related posts

- [Fast Inference on Large Language Models: BLOOMZ on Habana Gaudi2 Accelerator](https://swe.quest/articles/fast-inference-on-large-language-models-bloomz-on-habana-gaudi2-accelerator-b18b18c9b1b881f4.md): Hugging Face · 2023-03-28 · Medium · 8 min read · Inference & serving, LLMs, Hardware, Performance engineering
  BLOOMZ (176B parameters, 352 GB in 16-bit) runs inference on a single 8-HPU Habana Gaudi2 server using Optimum Habana with Habana's DeepSpeed-inference fork, HPU graphs and a KV cache.
- [Hugging Face on AMD Instinct MI300 GPU](https://swe.quest/articles/hugging-face-on-amd-instinct-mi300-gpu-f116bf43c7c06916.md): Hugging Face · 2024-05-21 · Easy · 7 min read · Inference & serving, Hardware, LLMs, Performance engineering, Model training
  Hugging Face's transformers and text-generation-inference (TGI) now run on AMD Instinct MI300X GPUs with no code changes, backed by a Kubernetes-scheduled CI pipeline that runs tens of thousands of unit tests on MI250 and MI300 hardware.
- [Text-Generation Pipeline on Intel® Gaudi® 2 AI Accelerator](https://swe.quest/articles/text-generation-pipeline-on-intel-gaudi-2-ai-accelerator-08fe7776346f5b95.md): Hugging Face · 2024-02-29 · Medium · 6 min read · Inference & serving, LLMs, Hardware, Python
  Optimum Habana's custom GaudiTextGenerationPipeline runs Llama 2 text generation (7b, 13b, 70b) on Intel Gaudi 2 with a few lines of code, handling pre- and post-processing end to end.
- [Preference Optimization for Vision Language Models](https://swe.quest/articles/preference-optimization-for-vision-language-models-a84799e96613bf21.md): Hugging Face · 2024-07-10 · Hard · 11 min read · Model training, Computer vision, LLMs, Python
  TRL now supports direct preference optimization (DPO) for vision language models, trained on chosen/rejected answer pairs rather than fixed labels.
- [AMD + 🤗: Large Language Models Out-of-the-Box Acceleration with AMD GPU](https://swe.quest/articles/amd-large-language-models-out-of-the-box-acceleration-with-amd-gpu-fa18508c54402fa1.md): Hugging Face · 2023-12-05 · Easy · 7 min read · Inference & serving, Hardware, LLMs, Performance engineering
  Hugging Face Transformers now runs all models and tasks on AMD Instinct GPUs with no code changes versus NVIDIA, backed by ROCm support for Flash Attention v2, vLLM Paged Attention, DeepSpeed, GPTQ via AutoGPTQ, ONNX Runtime's ROCMExecutionProvider, and Optimum-Benchmark.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
