Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions comps/embeddings/deployment/docker_compose/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ services:
multimodal-bridgetower-embedding-gaudi-serving:
condition: service_healthy

multimodal-bridgetower-embedding-server-offline:
<<: *multimodal-bridgetower-embedding-config
container_name: embedding-multimodal-bridgetower-server-offline
depends_on:
multimodal-bridgetower-embedding-serving-offline:
condition: service_healthy

multimodal-bridgetower-embedding-gaudi-server-offline:
<<: *multimodal-bridgetower-embedding-config
container_name: embedding-multimodal-bridgetower-gaudi-server-offline
depends_on:
multimodal-bridgetower-embedding-gaudi-serving-offline:
condition: service_healthy

networks:
default:
driver: bridge
31 changes: 31 additions & 0 deletions comps/embeddings/src/README_bridgetower.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,34 @@ curl -X POST http://0.0.0.0:6600/v1/embeddings \
```

This request will return an embedding representing the semantic meaning of the input text.

## Running in the air gapped environment

The following steps are common for running the dataprep microservice in an air gapped environment (a.k.a. environment with no internet access).

1. Download the necessary data

```shell
# Download model
export DATA_PATH="<model data directory>"
huggingface-cli download --cache-dir $DATA_PATH BridgeTower/bridgetower-large-itm-mlm-itc
# Download image for warmup
cd $DATA_PATH
wget https://llava-vl.github.io/static/images/view.jpg
```

2. launch the `embedding-multimodal-bridgetower` microservice with the following settings:

- For Gaudi HPU:

```bash
export DATA_PATH="<model data directory>"
docker compose up multimodal-bridgetower-embedding-gaudi-serving-offline multimodal-bridgetower-embedding-gaudi-server-offline -d
```

- For Xeon CPU:

```bash
export DATA_PATH="<model data directory>"
docker compose up multimodal-bridgetower-embedding-serving-offline multimodal-bridgetower-embedding-server-offline -d
```
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,59 @@ services:
retries: 18
start_period: 30s

multimodal-bridgetower-embedding-serving-offline:
image: ${REGISTRY:-opea}/embedding-multimodal-bridgetower:${TAG:-latest}
container_name: multimodal-bridgetower-embedding-serving-offline
ports:
- ${EMBEDDER_PORT:-12400}:${EMBEDDER_PORT:-12400}
ipc: host
environment:
HF_HUB_OFFLINE: 1
HF_HUB_CACHE: /data
# Use non-existing proxy to mimic air gapped environment
no_proxy: localhost,127.0.0.1,${offline_no_proxy}
http_proxy: http://localhost:7777
https_proxy: http://localhost:7777
PORT: ${EMBEDDER_PORT}
restart: unless-stopped
volumes:
- "${DATA_PATH:-./data}:/data"
healthcheck:
test: ["CMD-SHELL", "http_proxy='' curl -f http://localhost:${EMBEDDER_PORT}/v1/health_check"]
interval: 10s
timeout: 6s
retries: 18
start_period: 30s


multimodal-bridgetower-embedding-gaudi-serving-offline:
image: ${REGISTRY:-opea}/embedding-multimodal-bridgetower-gaudi:${TAG:-latest}
container_name: multimodal-bridgetower-embedding-gaudi-serving-offline
ports:
- ${EMBEDDER_PORT:-12400}:${EMBEDDER_PORT:-12400}
ipc: host
environment:
HF_HUB_OFFLINE: 1
HF_HUB_CACHE: /data
# Use non-existing proxy to mimic air gapped environment
no_proxy: localhost,127.0.0.1,${offline_no_proxy}
http_proxy: http://localhost:7777
https_proxy: http://localhost:7777
PORT: ${EMBEDDER_PORT}
HABANA_VISIBLE_DEVICES: all
volumes:
- "${DATA_PATH:-./data}:/data"
runtime: habana
cap_add:
- SYS_NICE
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "http_proxy='' curl -f http://localhost:${EMBEDDER_PORT}/v1/health_check"]
interval: 10s
timeout: 6s
retries: 18
start_period: 30s

networks:
default:
driver: bridge
33 changes: 33 additions & 0 deletions comps/third_parties/bridgetower/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,39 @@ cd comps/third_parties/bridgetower/deployment/docker_compose/
docker compose -f compose.yaml up -d multimodal-bridgetower-embedding-serving
```

## Running in the air gapped environment

The following steps are common for running the dataprep microservice in an air gapped environment (a.k.a. environment with no internet access).

1. Download the necessary data

```shell
# Download model
export DATA_PATH="<model data directory>"
huggingface-cli download --cache-dir $DATA_PATH BridgeTower/bridgetower-large-itm-mlm-itc
# Download image for warmup
cd $DATA_PATH
wget https://llava-vl.github.io/static/images/view.jpg
```

2. launch the `embedding-multimodal-bridgetower` microservice with the following settings:

- For Gaudi HPU:

```bash
export DATA_PATH="<model data directory>"
cd comps/third_parties/bridgetower/deployment/docker_compose/
docker compose -f compose.yaml up -d multimodal-bridgetower-embedding-gaudi-serving-offline
```

- For Xeon CPU:

```bash
export DATA_PATH="<model data directory>"
cd comps/third_parties/bridgetower/deployment/docker_compose/
docker compose -f compose.yaml up -d multimodal-bridgetower-embedding-serving-offline
```

## 🚀3. Access the service

Then you need to test your MMEI service using the following commands:
Expand Down
11 changes: 9 additions & 2 deletions comps/third_parties/bridgetower/src/bridgetower_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,18 @@ async def get_woker_status():

# warmup
print("Warmup...")
image_paths = ["https://llava-vl.github.io/static/images/view.jpg"]
is_offline = os.getenv("HF_HUB_OFFLINE") == "1"
if is_offline:
image_paths = ["/data/view.jpg"]
else:
image_paths = ["https://llava-vl.github.io/static/images/view.jpg"]
example_prompts = ["This is test image!"]
images = []
for image_path in image_paths:
images.append(PIL.Image.open(requests.get(image_path, stream=True, timeout=3000).raw))
if is_offline:
images.append(PIL.Image.open(image_path))
else:
images.append(PIL.Image.open(requests.get(image_path, stream=True, timeout=3000).raw))
for i in range(args.warmup):
embedder.embed_image_text_pairs(
example_prompts,
Expand Down
Loading