clip_embedding/README.md

53 lines
1.0 KiB
Markdown

# CLIP Embedding Service
CLIP-ViT-H/14 多模态 Embedding 服务,支持文本和图片向量化。
## Overview
- **Model**: laion/CLIP-ViT-H-14-laion2B-s32B-b79K
- **Dimension**: 1024
- **Precision**: float16
- **Port**: 9086
- **GPU**: 2 (default)
## API
### GET /api/status
Service health and GPU info.
### POST /api/text
Text embedding.
```json
{"texts": ["hello world", "a cat"]}
```
### POST /api/image
Image embedding (file path, URL, or base64 data URI).
```json
{"images": ["/path/to/img.jpg", "https://example.com/img.png"]}
```
### POST /api/embed
Combined text + image embedding.
```json
{"texts": ["a cat"], "images": ["/path/to/cat.jpg"]}
```
## Model Download (Offline Deploy)
```bash
pip install huggingface_hub
huggingface-cli download laion/CLIP-ViT-H-14-laion2B-s32B-b79K \
--local-dir /data/ymq/models/laion/CLIP-ViT-H-14-laion2B-s32B-b79K \
--local-dir-use-symlinks False
```
Size: ~15GB
## Deploy
```bash
bash build.sh deploy # start
bash build.sh stop # stop
bash build.sh status # check
```