[Bug]: GPU not being fully utilized

Open
#434 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
docker, python

Research direction

Start by reproducing the provided LateInteractionTextEmbedding and FastEmbedSparse example with fastembed-gpu==0.4.0, then inspect the provider and cuda settings alongside the docker-compose GPU reservation and Dockerfile-gpu. Done means determining why GPU usage differs from the report and documenting or correcting the behavior with evidence from the reproduction.

Written by the indexing model from the issue text.

Description

What happened?

I am currently using LateInteraction and BM25 model using fastembed library but my GPU is not being fully utilized! my provider is set to CUDAExecutionProvider, still only 4GB is being utilized out of 24GB!

What is the expected behaviour?

All of the available GPU memory should be utilized!

A minimal reproducible example

`def _initialize_colbert_model(gpu: bool):
"""Initialize ColBERT model with GPU or CPU based on the flag."""
provider = ["CUDAExecutionProvider"] if gpu else ["CPUExecutionProvider"]
use_cuda = True if gpu else False
logger.info(f"Initializing ColBERT model with {provider}")
return LateInteractionTextEmbedding("colbert-ir/colbertv2.0", providers=provider,cuda=use_cuda, parallel=0,local_files_only=LOCAL_FILES_ONLY)

def _initialize_sparse_bm25_model(gpu: bool):
"""Initialize FastEmbedSparse model with GPU or CPU based on the flag."""
provider = ["CUDAExecutionProvider"] if gpu else None
use_cuda = True if gpu else False
logger.info(f"Initializing FastEmbedSparse model with {'GPU' if gpu else 'CPU'}")
return FastEmbedSparse(providers=provider, cuda = use_cuda, parallel=0,local_files_only=LOCAL_FILES_ONLY)`

here is my docker-compose file:
`version: '3.8'

services:
web:
build:
context: .
dockerfile: Dockerfile-gpu
environment:
- GPU_DEPLOYMENT=TRUE
restart: always
ports:
- "5003:5003"
volumes:
- ./logs:/app/logs
deploy:
resources:
limits:
memory: 15g
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]`

What Python version are you on? e.g. python --version

python 3.12

FastEmbed version

fastembed-gpu==0.4.0

What os are you seeing the problem on?

Linux

Relevant stack traces and/or logs

No response

Dominant language
Python
Stars
3.3k
Forks
314
Avg merge
5d 7h
Merged PRs (30d)
23

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from qdrant/fastembed

All issues in qdrant/fastembed

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.